Re: Scans are offloaded to SeqScan instead of CustomScan when there are multiple relations in the same query

From: Amin <amin(dot)fallahi(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Scans are offloaded to SeqScan instead of CustomScan when there are multiple relations in the same query
Date: 2023-04-17 22:34:18
Message-ID: CAF-KA8-rViwvUVptnmacRfh9DvuMSE_3sWA7rWQzZFMevnLxCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

To simplify: Can CustomScan scan multiple relations in the same query or it
will always be assigned to one or zero relations?

On Fri, Apr 14, 2023 at 4:33 PM Amin <amin(dot)fallahi(at)gmail(dot)com> wrote:

> Hi there,
>
> In my implementation of CustomScan, when I have a query that scans
> multiple tables (select c from t1,t2,t3), the planner always picks one
> table to be scanned by CustomScan and offloads the rest to SeqScan. I tried
> assigning a cost of 0 to the CustomScan path, but still not working.
> BeginCustomScan gets executed, ExecCustomScan is skipped, and then
> EndCustomScan is executed for all the tables that are offloaded to Seq
> Scan. EXPLAIN shows that always only one table is picked to be executed by
> CustomScan. Any idea what I might be doing wrong? Like a value in a struct
> I might be setting incorrectly?
>
> Thanks!
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-04-17 22:40:14 Re: check_strxfrm_bug()
Previous Message Justin Pryzby 2023-04-17 22:10:29 Re: Fix typos and inconsistencies for v16