Re: How to prohibit parallel scan through tableam?

Lists: pgsql-hackers
From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: How to prohibit parallel scan through tableam?
Date: 2019-11-27 11:33:42
Message-ID: fafd6dae-0342-5a3c-c040-7828f5a595fb@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi hackers,

I wonder how it is possible to prohibit parallel scan for the external
storage accessed through tableam?
For example if I want to implement specialized tableam for fast access
to temp tables, how can I inform optimizer that
parallel scan is not possible (because table data is local to the backend)?

Thanks in advance,

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


From: Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to prohibit parallel scan through tableam?
Date: 2019-11-27 12:12:35
Message-ID: CA+FpmFeV4XH0du_60F5wKnoGku-fM_kACpRdMMTDLkYqePF3WA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, 27 Nov 2019 at 12:33, Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
wrote:

> Hi hackers,
>
> I wonder how it is possible to prohibit parallel scan for the external
> storage accessed through tableam?
> For example if I want to implement specialized tableam for fast access
> to temp tables, how can I inform optimizer that
> parallel scan is not possible (because table data is local to the backend)?
>
> How about setting parallel_setup_cost to disable_cost in costsize.c for
your specific scan method.

--
Regards,
Rafia Sabih


From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: How to prohibit parallel scan through tableam?
Date: 2019-11-27 13:10:20
Message-ID: fb63b86e-f862-b6f9-b321-360ad11172a6@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27.11.2019 15:12, Rafia Sabih wrote:
>
>
> On Wed, 27 Nov 2019 at 12:33, Konstantin Knizhnik
> <k(dot)knizhnik(at)postgrespro(dot)ru <mailto:k(dot)knizhnik(at)postgrespro(dot)ru>> wrote:
>
> Hi hackers,
>
> I wonder how it is possible to prohibit parallel scan for the
> external
> storage accessed through tableam?
> For example if I want to implement specialized tableam for fast
> access
> to temp tables, how can I inform optimizer that
> parallel scan is not possible (because table data is local to the
> backend)?
>
>  How about setting parallel_setup_cost to disable_cost in costsize.c
> for your specific scan method.

How can I do it if i just implementing my AM and not going to change any
postgres code?

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


From: Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to prohibit parallel scan through tableam?
Date: 2019-11-28 13:23:21
Message-ID: CA+FpmFf+PVYz4t1U1iKxEbRhZtGV+FfgSx2TTnkNWrn43wvaMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, 27 Nov 2019 at 12:33, Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
wrote:

> Hi hackers,
>
> I wonder how it is possible to prohibit parallel scan for the external
> storage accessed through tableam?
> For example if I want to implement specialized tableam for fast access
> to temp tables, how can I inform optimizer that
> parallel scan is not possible (because table data is local to the backend)?
>
> One moment, isn't that parallel scans are already restricted for temp
tables, or I have misunderstood something here...?

--
Regards,
Rafia Sabih


From: Andres Freund <andres(at)anarazel(dot)de>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to prohibit parallel scan through tableam?
Date: 2019-12-03 21:22:17
Message-ID: 20191203212217.lxqvnffiw5n5thzy@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

On 2019-11-27 14:33:42 +0300, Konstantin Knizhnik wrote:
> I wonder how it is possible to prohibit parallel scan for the external
> storage accessed through tableam?
> For example if I want to implement specialized tableam for fast access to
> temp tables, how can I inform optimizer that
> parallel scan is not possible (because table data is local to the backend)?

I don't think there currently is a good way to do so - but it shouldn't
be hard to add that capability.

Greetings,

Andres Freund


From: Andres Freund <andres(at)anarazel(dot)de>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: How to prohibit parallel scan through tableam?
Date: 2019-12-03 21:24:14
Message-ID: 20191203212414.qp4s2wljeodaz3xu@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 윈 토토 페치 실패

Hi,

On 2019-11-27 16:10:20 +0300, Konstantin Knizhnik wrote:
> On 27.11.2019 15:12, Rafia Sabih wrote:
> > On Wed, 27 Nov 2019 at 12:33, Konstantin Knizhnik
> > <k(dot)knizhnik(at)postgrespro(dot)ru <mailto:k(dot)knizhnik(at)postgrespro(dot)ru>> wrote:
> >
> > Hi hackers,
> >
> > I wonder how it is possible to prohibit parallel scan for the
> > external
> > storage accessed through tableam?
> > For example if I want to implement specialized tableam for fast
> > access
> > to temp tables, how can I inform optimizer that
> > parallel scan is not possible (because table data is local to the
> > backend)?
> >
> >  How about setting parallel_setup_cost to disable_cost in costsize.c for
> > your specific scan method.
>
> How can I do it if i just implementing my AM and not going to change any
> postgres code?

I think a set_rel_pathlist hook that prevents parallel paths from being
considered would be your best bet for now. But I encourage you to
suggest a patch to tableam to support it properly in future releases.

Greetings,

Andres Freund