Re: pervasiveness of surrogate (also called synthetic) keys

From: Misa Simic <misa(dot)simic(at)gmail(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pervasiveness of surrogate (also called synthetic) keys
Date: 2011-05-04 12:50:54
Message-ID: BANLkTinF0M9u_NojtRt0G98wiKhWT36v3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2011/5/4 Merlin Moncure <mmoncure(at)gmail(dot)com>

> Most of the old school accounting systems maintained an invoice line
> number.
>
> > Invoice Line
> > -Invoice Number
> > -LineNo
> > -ItemID
> > -qty
> > -Price
>
> The line number started from 1 (the first line on the invoice) on
> every unique invoice. This has the added benefit of allowing the
> primary key index (invoice_no, line_no) allowing you to pull up the
> invoice line records in correct order without requiring an extra sort
> and, if you don't need any fields from the invoice, a join.
>
> Compare the two queries pulling up invoice lines over a range of
> invoice numbers.
>
> merlin
>

Thanks, merlin,

And in that case, what is "Natural" in LineNo? I would say, with adding
LineNo we are creating syntethic/surrogate Key (just instead of 1 surrogate
column - it will be Compound key with more columns...)? The same is with all
other tables what are "parts" of an Entity, Serial Numbers, Accounting
Distribution produced by Invoice...etc etc...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-05-04 13:33:57 Re: pervasiveness of surrogate (also called synthetic) keys
Previous Message Merlin Moncure 2011-05-04 12:34:31 Re: pervasiveness of surrogate (also called synthetic) keys