Re: count(*) and bad design was: Experiences with extensibility

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: count(*) and bad design was: Experiences with extensibility
Дата
Msg-id 20080109105829.37f2958d@commandprompt.com
обсуждение исходный текст
Ответ на Re: count(*) and bad design was: Experiences with extensibility  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Ответы Re: count(*) and bad design was: Experiences with extensibility  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Re: count(*) and bad design was: Experiences with extensibility  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Список pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 9 Jan 2008 20:01:05 +0100
Ivan Sergio Borgonovo <mail@webthatworks.it> wrote:

> On Wed, 9 Jan 2008 10:30:45 -0600
> "Scott Marlowe" <scott.marlowe@gmail.com> wrote:
> 
> > Now, everything's a tradeoff.  If PostgreSQL had visibility
> > information in the indexes, it would have to lock both the table and
> > index for every write, thus slowing down all the other queries that
> > are trying to access the table.  It would be a tradeoff that
> > sacrificed write speed for read speed. In a db that was used mostly
> > for writing, it would likely be a fair trade.  In a db that did a
> > lot of writing, it might slow the whole thing to a crawl.
> 
> OK... we are getting near to the point. I understand the trade-off
> problem in storing into indexes id the row is still there.
> Is there a way to get the count of the rows that *may be* there, 

If you analyze regularly you can use pg_class. It isn't exact but is
usually close enough (especially if you are just using it for something
like pagination).

Joshua D. Drake



- -- 
The PostgreSQL Company: Since 1997, http://www.commandprompt.com/ 
Sales/Support: +1.503.667.4564   24x7/Emergency: +1.800.492.2240
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
SELECT 'Training', 'Consulting' FROM vendor WHERE name = 'CMD'


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHhRlVATb/zqfZUUQRAoQmAJ4nkBHmZEsC8UusCT7+qul1Qa9/0QCeJFru
gnBj3ROCMz+vqbF/1Z78roY=
=iVOP
-----END PGP SIGNATURE-----

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

Предыдущее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: Re: count(*) and bad design was: Experiences with extensibility
Следующее
От: mljv@planwerk6.de
Дата:
Сообщение: Prepared Statements