Re: READ COMMITTED vs. index-only scans - Mailing list pgsql-general

From Francisco Olarte
Subject Re: READ COMMITTED vs. index-only scans
Date
Msg-id CA+bJJbz5Sj5nBAxH4My4P9ZXg+3Y5mmn8H5C8FOkaHzqPTh4pg@mail.gmail.com
Whole thread Raw
In response to Re: READ COMMITTED vs. index-only scans  (Melvin Davidson <melvin6925@gmail.com>)
List pgsql-general
On Wed, Jan 17, 2018 at 3:30 PM, Melvin Davidson <melvin6925@gmail.com> wrote:
....
> Just a suggestion. The first query is not really needed.
> You can simply do:
> second query (B):
>
> SELECT id
> , ...
>   FROM events
>  WHERE id > MIN(ID)
>    AND id <= MAX(ID)
>    AND ...
>
> See https://www.postgresql.org/docs/9.6/static/functions-aggregate.html
> MAX and MIN functions

Are you sure? ( http://sqlfiddle.com/#!17/7805a/3 )

In fact your link, in the first paragraph, points to
https://www.postgresql.org/docs/9.6/static/tutorial-agg.html which,
near the end ( 2nd paragraph from the end, I think its called next to
last in English, but not sure if penultimate is the correct word, like
in Spanish ), states:

"Thus, the WHERE clause must not contain aggregate functions; it makes
no sense to try to use an aggregate to determine which rows will be
inputs to the aggregates."

Francisco Olarte.


pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: READ COMMITTED vs. index-only scans
Next
From: Jacek Kołodziej
Date:
Subject: Re: READ COMMITTED vs. index-only scans