On Thu, Sep 13, 2018 at 11:40 AM Jesper Pedersen <jesper.peder...@redhat.com> wrote: > > I noticed that current implementation doesn't > > perform well when we have lots of small groups of equal values. Here is > > the execution time of index skip scan vs unique over index scan, in ms, > > depending on the size of group. The benchmark script is attached. > > > > group size skip unique > > 1 2,293.85 132.55 > > 5 464.40 106.59 > > 10 239.61 102.02 > > 50 56.59 98.74 > > 100 32.56 103.04 > > 500 6.08 97.09 > > > > Yes, this doesn't look good. Using your test case I'm seeing that unique > is being chosen when the group size is below 34, and skip above.
I'm not sure exactly how the current patch is approaching the problem, but it seems like it might be reasonable to do something like -- look for a distinct item within the current page; if not found, then search from the root of the tree for the next item > the current item. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company