Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinplementation for MR #251 #395

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Reinplementation for MR #251 #395

wants to merge 1 commit into from

Conversation

bz007
Copy link

@bz007 bz007 commented Apr 22, 2024

Use CREATE TABLE as SELECT allowing parallel plans if it is possible.

Use CREATE TABLE as SELECT allowing parallel plans if it is possible.
@bz007
Copy link
Author

bz007 commented Apr 22, 2024

I've reimplemented MR #251. The only problem is with TABLESPACE tests, it is not good.

@levinsv
Copy link

levinsv commented May 6, 2024

Hi!
I applied this patch and performed clustering on a large table of 88 million rows.

env PGOPTIONS="-c work_mem=100MB -c enable_indexscan=off" pg_repack -t past.history__0191_2404 -T 600 -o def,inv,dt -s ts_compress -S

This query plan:

SQL QUERY: CREATE TABLE repack.table_6378674 WITH (fillfactor=95, autovacuum_analyze_threshold=10000, autovacuum_vacuum_scale_factor=0.01, oids = false)  TABLESPACE ts_compress AS SELECT inv,def,dt,quality,value_num,value_dt,value_char FROM ONLY past.history__0191_2404 ORDER BY def,inv,dt
Gather Merge (Current loop: running time=10848.435 actual rows=0, loop number=1)
  Workers Planned: 2
  Workers Launched: 2
  ->  Sort (Current loop: running time=10846.615 actual rows=0, loop number=1)
        Sort Key: def, inv, dt
        ->  Parallel Seq Scan on history__0191_2404 (Current loop: actual time=1.236..7897.329 rows=22189018, loop number=1)
              Buffers: shared hit=30687 read=142746 dirtied=19995
              I/O Timings: shared/local read=2626.642

This top output:

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
2938492 postgres  20   0   44.0g   2.6g  10824 R 100.0   2.7   0:30.09 postgres: asu: parallel worker for PID 2938490
2938493 postgres  20   0   44.0g   2.5g  10564 R 100.0   2.6   0:30.17 postgres: asu: parallel worker for PID 2938490
2938490 postgres  20   0   44.0g   2.6g  15000 R  99.7   2.7   0:30.16 postgres: asu: postgres asu [local] CREATE TABLE AS

Great patch. Increases operating speed by 3 times.
I hope the developers will accept it.
The benefit of the patch is obvious.

@levinsv
Copy link

levinsv commented May 31, 2024

Hi!
What should I do to accept this request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants