Search Postgresql Archives

Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxxxx> writes:
> svnlog=# SELECT revision_id FROM revision_files WHERE file_id=(SELECT 
> file_id
> FROM files WHERE filepath='/trunk/app/widgets/gimptoolbox-dnd.c' LIMIT 1)
> ORDER BY revision_id DESC LIMIT 1;
>   revision_id
> -------------
>         15011
> (1 row)

> Time: 935.816 ms

Hmm, I'd expect it to be more or less instantaneous given the right
index.  What does EXPLAIN ANALYZE say about this?

> However, some more searching came up with this "ORDER BY x + 0" 
> variation which seems to consistently perform the fastest for varying 
> flavours of revision_id by forcing use of the file_id index:

And that?

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux