Re: READ COMMITTED vs. index-only scans

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: Jacek Kołodziej <kolodziejj(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: READ COMMITTED vs. index-only scans
Date: 2018-01-17 15:21:53
Message-ID: CA+bJJbz5Sj5nBAxH4My4P9ZXg+3Y5mmn8H5C8FOkaHzqPTh4pg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 17, 2018 at 3:30 PM, Melvin Davidson <melvin6925(at)gmail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jacek Kołodziej 2018-01-17 15:45:11 Re: READ COMMITTED vs. index-only scans
Previous Message Laurenz Albe 2018-01-17 15:17:06 Re: READ COMMITTED vs. index-only scans