Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
Date
Msg-id 20240919.104917.2122304193044088479.ishii@postgresql.org
Whole thread Raw
In response to Add memory/disk usage for WindowAgg nodes in EXPLAIN  (Tatsuo Ishii <ishii@postgresql.org>)
Responses Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
List pgsql-hackers
> That code could be modified to swap the tuplestores and do a
> tuplestore_clear() instead of tuplestore_end() followed by
> tuplestore_begin_heap().
> 
> It's likely worthwhile from a performance point of view.  Here's a
> small test as an example:
> 
> master:
> postgres=# with recursive cte (a) as (select 1 union all select
> cte.a+1 from cte where cte.a+1 <= 1000000) select count(*) from cte;
> Time: 219.023 ms
> Time: 218.828 ms
> Time: 219.093 ms
> 
> with attached patched:
> postgres=# with recursive cte (a) as (select 1 union all select
> cte.a+1 from cte where cte.a+1 <= 1000000) select count(*) from cte;
> Time: 169.734 ms
> Time: 164.841 ms
> Time: 169.168 ms

Impressive result. I also ran your query with count 1000.

without the patch:
Time: 3.655 ms
Time: 4.123 ms
Time: 2.163 ms

wit the patch:
Time: 3.641 ms
Time: 2.356 ms
Time: 2.347 ms

It seems with the patch the performance is slightly better or almost
same. I think the patch improves the performance without sacrificing
the smaller iteration case.

Best reagards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp



pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation
Next
From: David Rowley
Date:
Subject: Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN