Re: Seqscan in MAX(index_column)
От
Greg Stark
Тема
Re: Seqscan in MAX(index_column)
Дата
Msg-id
87vfs78bk6.fsf@stark.dyndns.tv
Ответ на
Re: Seqscan in MAX(index_column) (scott.marlowe)
Список
Дерево обсуждения
Re: Seqscan in MAX(index_column) Christopher Browne <cbbrowne@acm.org>
Re: Seqscan in MAX(index_column) Tom Lane <tgl@sss.pgh.pa.us>
Re: Seqscan in MAX(index_column) Bruce Momjian <pgman@candle.pha.pa.us>
Re: Seqscan in MAX(index_column) Dennis Bjorklund <db@zigo.dhs.org>
"scott.marlowe" writes: > Would it be possible to catch an unconstrained max(id)/min(id) and rewrite > it as "select id from table order by id [desc] limit1" on the fly in the > parser somewhere? > > That would require fairly little code, and be transparent to the user. > I.e. low hanging fruit. What if there's no index on id? Then it would actually be slower than the straightforward approach. You would have to check both versions and take the one with the lowest cost, or check before rewriting for possible paths on that column. The problem with low hanging fruit is sometimes it makes people stop looking for real solutions. And I think the real solution is worthwhile here. -- greg
В списке pgsql-hackers по дате отправления