Re: Suggestion for optimization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Suggestion for optimization
Дата
Msg-id 9823.1018038107@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Suggestion for optimization  ("Dann Corbit" <DCorbit@connx.com>)
Список pgsql-hackers
"Dann Corbit" <DCorbit@connx.com> writes:
> At any rate, there is clearly a concept of cardinality in any case.

Certainly.  The count(*) value is perfectly well defined within any one
transaction.  We *could*, if we wanted to, implement bookkeeping logic
that would keep track of the number of rows inserted by all transactions
and allow derivation of the count-as-seen-by-any-one-transaction at all
times.  The point is that that logic would be vastly more complex than
you thought it would be; and it would not be optional.  (AFAICS, the
counts would have to be determined at postmaster startup and then
maintained faithfully by all transactions.  There wouldn't be any good
way for a transaction to initialize the bookkeeping logic on-the-fly ---
unless you call acquiring an exclusive lock on a table good.)  No one
who's looked at it has thought that it would be a good tradeoff for
making count(*) faster.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Dann Corbit"
Дата:
Сообщение: Re: Suggestion for optimization
Следующее
От: "Rod Taylor"
Дата:
Сообщение: Re: Suggestion for optimization