Re: formatting of SQL sent by PHP to postgres - Mailing list pgsql-general

From Greg Stark
Subject Re: formatting of SQL sent by PHP to postgres
Date
Msg-id 871xsucqt6.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: formatting of SQL sent by PHP to postgres  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
"scott.marlowe" <scott.marlowe@ihs.com> writes:

> Postgresql's MVCC design makes it hard to use indexes for aggregate
> functions.  So, if you use something like max(id), postgresql literally
> has to seq scan the table to find the max(id).  MVCC allows postgresql to
> handle massive parallel load.  It causes some minor performance issues
> like that that are hard to code around cleanly.

That postgres doesn't use indexes for max/min is really not related to MVCC.
It would be a lot of work to do so and involve changes to lots of places and
it just hasn't been done yet. But it can be done and would be just as hard
without MVCC.

You're thinking of caching aggregate results for things like count(). That's
where supporting transactions makes it hard. But that's really unrelated to
min/max and indexes.

--
greg

pgsql-general by date:

Previous
From: Robert Treat
Date:
Subject: Re: formatting of SQL sent by PHP to postgres
Next
From: Karsten Hilbert
Date:
Subject: Re: Automatic auditing suggestion