Re: Use of additional index columns in rows filtering - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Use of additional index columns in rows filtering
Date
Msg-id e31162ba4c75a50e41397aa6aaceb0ca79f125f1.camel@j-davis.com
Whole thread Raw
In response to Re: Use of additional index columns in rows filtering  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Responses Re: Use of additional index columns in rows filtering
List pgsql-hackers
On Wed, 2023-07-19 at 20:03 +0200, Tomas Vondra wrote:
> Makes sense, I also need to think about maybe not having duplicate
> clauses in the two lists. What annoys me on that it partially
> prevents
> the cost-based reordering done by order_qual_clauses(). So maybe we
> should have three lists ... Also, some of the expressions count be
> fairly expensive.

Can we just calculate the costs of the pushdown and do it when it's a
win? If the random_page_cost savings exceed the costs from evaluating
the clause earlier, then push down.

> BTW could you double-check how I expanded the index_getnext_slot()? I
> recall I wasn't entirely confident the result is correct, and I
> wanted
> to try getting rid of the "while (true)" loop.

I suggest refactoring slightly to have the two loops in different
functions (rather than nested loops in the same function) to make
control flow a bit more clear. I'm not sure if the new function for the
inner loop should be defined in nodeIndexscan.c or indexam.c; I suppose
it depends on how clean the signature looks.

Also please expand the tests a bit to show more EXPLAIN plans that
illustrate the different cases.

Regards,
    Jeff Davis




pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Extracting cross-version-upgrade knowledge from buildfarm client
Next
From: Andrew Dunstan
Date:
Subject: Re: Extracting cross-version-upgrade knowledge from buildfarm client