From: | Jesper Krogh <jesper(at)krogh(dot)cc> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Evaluation of secondary sort key. |
Date: | 2011-04-09 18:53:31 |
Message-ID: | 4DA0AB2B.9050408@krogh.cc |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2011-04-09 20:00, David Fetter wrote:
> Given the horrors query generators perpetrate, it might be worth
> dropping provably redundant ORDER BYs on the floor at planning time.
Well, many people often add a secondary sort-key to their SQL
for the only purpose of obtainting a consistent result in the
corner-cases where the first sort key is ambiguios.
If the first sort-key isn't planned to be supported by an index-scan,
then you'll end up calculating the second sortkey for the entire
dataset even if you end up doing a "limit 100" at the end.
You can only deem it redundant if there is a primary key in front.
if you have a primary key in front, where as a fix may be really
good in cases where you have a "n_distinct" at or near -1 in pg_stats
for the column.
Jesper
--
Jesper
From | Date | Subject | |
---|---|---|---|
Next Message | Jesper Krogh | 2011-04-09 19:05:50 | Re: Evaluation of secondary sort key. |
Previous Message | Joshua Berkus | 2011-04-09 18:26:14 | Feature request: pg_basebackup --force |