Re: Asynchronous execution support for Custom Scan

From: Kazutaka Onishi <onishi(at)heterodb(dot)com>
To: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
Cc: Kohei KaiGai <kaigai(at)heterodb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Asynchronous execution support for Custom Scan
Date: 2022-09-02 13:43:16
Message-ID: CAJuF6cOO9j6WLQ=jugUX6Gv5TwqBgdT8YSCo9C4VJbudm6nRAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Fujii-san,

The asynchronous version "ctidscan" plugin is ready.
Please check this.
https://github.com/0-kaz/ctidscan/tree/async_sample

I've confirmed this works correctly by running SQL shown below.
The query plan shows 2 custom scan works asynchronously.

postgres=# LOAD 'ctidscan';
LOAD
postgres=# EXPLAIN ANALYZE SELECT * FROM t1 WHERE ctid BETWEEN
'(2,1)'::tid AND '(3,10)'::tid
UNION
SELECT * FROM (SELECT * FROM t1 WHERE ctid BETWEEN '(2,115)'::tid AND
'(3,10)'::tid);
QUERY
PLAN
------------------------------------------------------------------------------------------------------------------------------------
HashAggregate (cost=3.55..5.10 rows=155 width=36) (actual
time=0.633..0.646 rows=130 loops=1)
Group Key: t1.a, t1.b
Batches: 1 Memory Usage: 48kB
-> Append (cost=0.01..2.77 rows=155 width=36) (actual
time=0.035..0.590 rows=146 loops=1)
-> Async Custom Scan (ctidscan) on t1 (cost=0.01..1.00
rows=134 width=37) (actual time=0.009..0.129 rows=130 loops=1)
Filter: ((ctid >= '(2,1)'::tid) AND (ctid <= '(3,10)'::tid))
Rows Removed by Filter: 30
ctid quals: ((ctid >= '(2,1)'::tid) AND (ctid <= '(3,10)'::tid))
-> Async Custom Scan (ctidscan) on t1 t1_1 (cost=0.01..1.00
rows=21 width=37) (actual time=0.003..0.025 rows=16 loops=1)
Filter: ((ctid >= '(2,115)'::tid) AND (ctid <= '(3,10)'::tid))
Rows Removed by Filter: 144
ctid quals: ((ctid >= '(2,115)'::tid) AND (ctid <=
'(3,10)'::tid))
Planning Time: 0.314 ms
Execution Time: 0.762 ms
(14 rows)

Regards,

2022年8月26日(金) 17:18 Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>:
>
> Hi KaiGai-san,
>
> On Tue, Aug 23, 2022 at 6:26 PM Kohei KaiGai <kaigai(at)heterodb(dot)com> wrote:
> > I internally suggested him to expand the ctidscan module for the PoC purpose.
> > https://github.com/kaigai/ctidscan
> >
> > Even though it does not have asynchronous capability actually, but
> > suitable to ensure
> > API works and small enough for reviewing.
>
> Seems like a good idea.
>
> Thanks!
>
> Best regards,
> Etsuro Fujita

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-09-02 14:20:40 Re: allowing for control over SET ROLE
Previous Message Amit Kapila 2022-09-02 13:40:02 Re: Column Filtering in Logical Replication