Search Postgresql Archives

Re: select distinct and index usage

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

 



Gregory Stark escribió:

> I thought our DISTINCT index scan does do that but it still has to read the
> index leaf pages sequentially. It doesn't back-track up the tree structure and
> refind the next key.

The way to back-track is to start the scan over from the root page down,
keeping a stack of parent pages as you go down (mainly because we need
to lock them in order, topmost first).  So it's not a particularly cheap
operation.  I'm not sure the situation with thousands of equal keys is
common enough to warrant adding all the code that would be needed to
implement the kind of "distinct scan" that you suggest, even though it
certainly is a nice idea.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


[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