Re: pervasiveness of surrogate (also called synthetic) keys
От | Misa Simic |
---|---|
Тема | Re: pervasiveness of surrogate (also called synthetic) keys |
Дата | |
Msg-id | BANLkTinF0M9u_NojtRt0G98wiKhWT36v3w@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: pervasiveness of surrogate (also called synthetic) keys (Merlin Moncure <mmoncure@gmail.com>) |
Ответы |
Re: pervasiveness of surrogate (also called synthetic) keys
Re: pervasiveness of surrogate (also called synthetic) keys |
Список | pgsql-general |
2011/5/4 Merlin Moncure <mmoncure@gmail.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...
В списке pgsql-general по дате отправления: