Re: Tid scan improvements

From: Edmund Horner <ejrh00(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Tid scan improvements
Date: 2018-12-21 08:04:58
Message-ID: CAMyN-kAJBX8BNAx--UwruKaN6ctpOz6t+MRmiKRv2pRKy+FTFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 21 Dec 2018 at 16:31, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Edmund Horner <ejrh00(at)gmail(dot)com> writes:
> > For the forward scan, I seem to recall, from your merge join example,
> > that it's useful to set the pathkeys even when there are no
> > query_pathkeys. We just have to unconditionally set them so that the
> > larger plan can make use of them.
>
> No. Look at indxpath.c: it does not worry about pathkeys unless
> has_useful_pathkeys is true, and it definitely does not generate
> pathkeys that don't get past truncate_useless_pathkeys. Those
> functions are responsible for worrying about whether mergejoin
> can use the pathkeys. It's not tidpath.c's job to outthink them.

Ok. I think that will simplify things. So if I follow you correctly,
we should do:

1. If has_useful_pathkeys is true: generate pathkeys (for CTID ASC),
and use truncate_useless_pathkeys on them.
2. If we have tid quals or pathkeys, emit a TID scan path.

For the (optional) backwards scan support patch, should we separately
emit another path, in the reverse direction? (My current patch only
creates one path, and tries to decide what the best direction is by
looking at query_pathkeys. This doesn't fit into the above
algorithm.)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yuzuko Hosoya 2018-12-21 08:21:43 RE: Improve selectivity estimate for range queries
Previous Message Michael Paquier 2018-12-21 07:13:00 Re: Tab completion for ALTER INDEX|TABLE ALTER COLUMN SET STATISTICS