Skip to content

Commit

Permalink
[Feature] fix some performance guc default
Browse files Browse the repository at this point in the history
  • Loading branch information
HBKO committed Jul 18, 2023
1 parent 95aeb5b commit b33622d
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 203 deletions.
2 changes: 1 addition & 1 deletion src/backend/utils/misc/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5845,7 +5845,7 @@ static struct config_int ConfigureNamesInt[] =
GUC_UNIT_BLOCKS
},
&polar_bulk_extend_size,
0, 0, INT_MAX / 2,
512, 0, INT_MAX / 2,
NULL, NULL, NULL
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/backend/utils/misc/postgresql.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@
# %% = '%'
# e.g. '<%u%%%d> '
#log_lock_waits = off # log lock waits >= deadlock_timeout
#log_statement = 'none' # none, ddl, mod, all
log_statement = 'ddl' # none, ddl, mod, all

#log_replication_commands = off
#log_temp_files = -1 # log temporary files equal or larger
# than the specified size in kilobytes;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/misc/postgresql.conf.sample.polardb_pg
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ log_planner_stats=off
log_replication_commands=off
log_rotation_age=0
log_rotation_size=131072 #128MB
log_statement='all'
log_statement='ddl'
log_statement_stats=off
log_temp_files=100000
log_timezone='UTC'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
-- the regression test cases don't create an big table.
ALTER SYSTEM SET polar_index_bulk_extend_size = 512;
ALTER SYSTEM SET polar_min_bulk_extend_table_size = 0;
ALTER SYSTEM SET polar_bulk_extend_size = 0;
SELECT pg_reload_conf();
pg_reload_conf
----------------
Expand Down Expand Up @@ -39,8 +40,9 @@ SELECT * FROM test_index_bulk_extend LIMIT 1;

DROP INDEX test_index_bulk;
DROP TABLE test_index_bulk_extend;
RESET polar_index_bulk_extend_size;
RESET polar_min_bulk_extend_table_size;
ALTER SYSTEM RESET polar_index_bulk_extend_size;
ALTER SYSTEM RESET polar_min_bulk_extend_table_size;
ALTER SYSTEM RESET polar_bulk_extend_size;
SELECT pg_reload_conf();
pg_reload_conf
----------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,36 +405,24 @@ select * from t, pt where tid = ptid and t1 = 'hello' || tid;
(33 rows)

explain (costs off, timing off, summary off) select * from t, pt where t1 = pt1 and ptid = tid;
QUERY PLAN
---------------------------------------------------------------
Nested Loop
-> Seq Scan on t
-> Append
-> Seq Scan on pt_p0
Filter: ((t.t1 = pt1) AND (t.tid = ptid))
-> Seq Scan on pt_p1
Filter: ((t.t1 = pt1) AND (t.tid = ptid))
-> Bitmap Heap Scan on pt_p2
Recheck Cond: ((ptid = t.tid) AND (pt1 = t.t1))
-> BitmapAnd
-> Bitmap Index Scan on pt_p2_ptid_idx
Index Cond: (ptid = t.tid)
-> Bitmap Index Scan on pt_p2_pt1_idx
Index Cond: (pt1 = t.t1)
-> Bitmap Heap Scan on pt_p3
Recheck Cond: ((ptid = t.tid) AND (pt1 = t.t1))
-> BitmapAnd
-> Bitmap Index Scan on pt_p3_ptid_idx
Index Cond: (ptid = t.tid)
-> Bitmap Index Scan on pt_p3_pt1_idx
Index Cond: (pt1 = t.t1)
-> Seq Scan on pt_p4
Filter: ((t.t1 = pt1) AND (t.tid = ptid))
-> Seq Scan on pt_p5
Filter: ((t.t1 = pt1) AND (t.tid = ptid))
-> Seq Scan on pt_p6
Filter: ((t.t1 = pt1) AND (t.tid = ptid))
(27 rows)
QUERY PLAN
-----------------------------------------------------
Merge Join
Merge Cond: (pt_p0.pt1 = t.t1)
Join Filter: (t.tid = pt_p0.ptid)
-> Merge Append
Sort Key: pt_p0.pt1
-> Index Scan using pt_p0_pt1_idx on pt_p0
-> Index Scan using pt_p1_pt1_idx on pt_p1
-> Index Scan using pt_p2_pt1_idx on pt_p2
-> Index Scan using pt_p3_pt1_idx on pt_p3
-> Index Scan using pt_p4_pt1_idx on pt_p4
-> Index Scan using pt_p5_pt1_idx on pt_p5
-> Index Scan using pt_p6_pt1_idx on pt_p6
-> Sort
Sort Key: t.t1
-> Seq Scan on t
(15 rows)

select * from t, pt where t1 = pt1 and ptid = tid;
dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid
Expand Down Expand Up @@ -1812,30 +1800,23 @@ set polar_px_optimizer_enable_seqscan=on;
set polar_px_optimizer_enable_hashjoin=on;
set polar_px_optimizer_enable_nestloopjoin=off;
explain (costs off, timing off, summary off) select * from t, pt where t1 = pt1;
QUERY PLAN
------------------------------------------------------
Nested Loop
-> Seq Scan on t
-> Append
-> Seq Scan on pt_p0
Filter: (t.t1 = pt1)
-> Seq Scan on pt_p1
Filter: (t.t1 = pt1)
-> Bitmap Heap Scan on pt_p2
Recheck Cond: (pt1 = t.t1)
-> Bitmap Index Scan on pt_p2_pt1_idx
Index Cond: (pt1 = t.t1)
-> Bitmap Heap Scan on pt_p3
Recheck Cond: (pt1 = t.t1)
-> Bitmap Index Scan on pt_p3_pt1_idx
Index Cond: (pt1 = t.t1)
-> Seq Scan on pt_p4
Filter: (t.t1 = pt1)
-> Seq Scan on pt_p5
Filter: (t.t1 = pt1)
-> Seq Scan on pt_p6
Filter: (t.t1 = pt1)
(21 rows)
QUERY PLAN
-----------------------------------------------------
Merge Join
Merge Cond: (pt_p0.pt1 = t.t1)
-> Merge Append
Sort Key: pt_p0.pt1
-> Index Scan using pt_p0_pt1_idx on pt_p0
-> Index Scan using pt_p1_pt1_idx on pt_p1
-> Index Scan using pt_p2_pt1_idx on pt_p2
-> Index Scan using pt_p3_pt1_idx on pt_p3
-> Index Scan using pt_p4_pt1_idx on pt_p4
-> Index Scan using pt_p5_pt1_idx on pt_p5
-> Index Scan using pt_p6_pt1_idx on pt_p6
-> Sort
Sort Key: t.t1
-> Seq Scan on t
(14 rows)

select * from t, pt where t1 = pt1;
dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid
Expand Down Expand Up @@ -2244,38 +2225,41 @@ insert into t1 select i, -100, 'dummy' from generate_series(1,10) i;
analyze t;
analyze t1;
explain (costs off, timing off, summary off) select * from t, t1, pt where t1.tid = ptid and t.tid = ptid;
QUERY PLAN
-----------------------------------------
Hash Join
Hash Cond: (pt_p0.ptid = t1.tid)
-> Hash Join
Hash Cond: (pt_p0.ptid = t.tid)
-> Append
-> Seq Scan on pt_p0
-> Seq Scan on pt_p1
-> Seq Scan on pt_p2
-> Seq Scan on pt_p3
-> Seq Scan on pt_p4
-> Seq Scan on pt_p5
-> Seq Scan on pt_p6
-> Hash
QUERY PLAN
------------------------------------------------------------
Merge Join
Merge Cond: (pt_p0.ptid = t1.tid)
-> Merge Join
Merge Cond: (pt_p0.ptid = t.tid)
-> Merge Append
Sort Key: pt_p0.ptid
-> Index Scan using pt_p0_ptid_idx on pt_p0
-> Index Scan using pt_p1_ptid_idx on pt_p1
-> Index Scan using pt_p2_ptid_idx on pt_p2
-> Index Scan using pt_p3_ptid_idx on pt_p3
-> Index Scan using pt_p4_ptid_idx on pt_p4
-> Index Scan using pt_p5_ptid_idx on pt_p5
-> Index Scan using pt_p6_ptid_idx on pt_p6
-> Sort
Sort Key: t.tid
-> Seq Scan on t
-> Hash
-> Sort
Sort Key: t1.tid
-> Seq Scan on t1
(16 rows)
(19 rows)

select * from t, t1, pt where t1.tid = ptid and t.tid = ptid;
dist | tid | t1 | t2 | dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid
------+-----+--------+-----+------+-----+--------+-----+------+---------+-------+-----------+------
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 1 | hello1 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 7 | hello7 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 13 | hello13 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 19 | hello19 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 25 | hello25 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 31 | hello31 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 37 | hello37 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 43 | hello43 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 49 | hello49 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 43 | hello43 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 37 | hello37 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 31 | hello31 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 25 | hello25 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 19 | hello19 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 13 | hello13 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 7 | hello7 | world | drop this | 1
1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 1 | hello1 | world | drop this | 1
(9 rows)

rollback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,20 +364,23 @@ select * from t, pt where tid = ptid and t1 = 'hello' || tid;
(30 rows)

explain (costs off, timing off, summary off) select * from t, pt where t1 = pt1 and ptid = tid;
QUERY PLAN
------------------------------------------------------------
Hash Join
Hash Cond: ((pt_p1.pt1 = t.t1) AND (pt_p1.ptid = t.tid))
-> Append
-> Seq Scan on pt_p1
-> Seq Scan on pt_p2
-> Seq Scan on pt_p3
-> Seq Scan on pt_p4
-> Seq Scan on pt_p5
-> Seq Scan on pt_junk_data
-> Hash
QUERY PLAN
-------------------------------------------------------------------
Merge Join
Merge Cond: (pt_p1.pt1 = t.t1)
Join Filter: (t.tid = pt_p1.ptid)
-> Merge Append
Sort Key: pt_p1.pt1
-> Index Scan using pt_p1_pt1_idx on pt_p1
-> Index Scan using pt_p2_pt1_idx on pt_p2
-> Index Scan using pt_p3_pt1_idx on pt_p3
-> Index Scan using pt_p4_pt1_idx on pt_p4
-> Index Scan using pt_p5_pt1_idx on pt_p5
-> Index Scan using pt_junk_data_pt1_idx on pt_junk_data
-> Sort
Sort Key: t.t1
-> Seq Scan on t
(11 rows)
(14 rows)

select * from t, pt where t1 = pt1 and ptid = tid;
dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid
Expand Down Expand Up @@ -1627,20 +1630,22 @@ set polar_px_optimizer_enable_seqscan=on;
set polar_px_optimizer_enable_hashjoin=on;
set polar_px_optimizer_enable_nestloopjoin=off;
explain (costs off, timing off, summary off) select * from t, pt where t1 = pt1;
QUERY PLAN
--------------------------------------
Hash Join
Hash Cond: (pt_p1.pt1 = t.t1)
-> Append
-> Seq Scan on pt_p1
-> Seq Scan on pt_p2
-> Seq Scan on pt_p3
-> Seq Scan on pt_p4
-> Seq Scan on pt_p5
-> Seq Scan on pt_junk_data
-> Hash
QUERY PLAN
-------------------------------------------------------------------
Merge Join
Merge Cond: (pt_p1.pt1 = t.t1)
-> Merge Append
Sort Key: pt_p1.pt1
-> Index Scan using pt_p1_pt1_idx on pt_p1
-> Index Scan using pt_p2_pt1_idx on pt_p2
-> Index Scan using pt_p3_pt1_idx on pt_p3
-> Index Scan using pt_p4_pt1_idx on pt_p4
-> Index Scan using pt_p5_pt1_idx on pt_p5
-> Index Scan using pt_junk_data_pt1_idx on pt_junk_data
-> Sort
Sort Key: t.t1
-> Seq Scan on t
(11 rows)
(13 rows)

select * from t, pt where t1 = pt1;
dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid
Expand Down
Loading

0 comments on commit b33622d

Please sign in to comment.