Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit581075a

Browse files
committed
Merge branch 'master' into hash
2 parents21dd5c8 +d514103 commit581075a

File tree

2 files changed

+37
-29
lines changed

2 files changed

+37
-29
lines changed

‎expected/pg_pathman.out

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ begin
621621
perform test.pathman_equal((plan->0->'Plan'->'Plans'->1->'Relation Name')::text,
622622
'"runtime_test_1_1"',
623623
'wrong partition');
624+
625+
select count(*) from jsonb_array_elements_text(plan->0->'Plan'->'Plans') into num;
626+
perform test.pathman_equal(num::text, '2', 'expected 2 child plans for custom scan');
627+
624628
return 'ok';
625629
end;
626630
$$ language plpgsql;
@@ -629,7 +633,7 @@ declare
629633
plan jsonb;
630634
num int;
631635
begin
632-
plan = test.pathman_test('select * from test.runtime_test_1 where id = any (select * from test.run_values limit6)');
636+
plan = test.pathman_test('select * from test.runtime_test_1 where id = any (select * from test.run_values limit4)');
633637

634638
perform test.pathman_equal((plan->0->'Plan'->'Node Type')::text,
635639
'"Nested Loop"',
@@ -644,9 +648,9 @@ begin
644648
'wrong plan provider');
645649

646650
select count(*) from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans') into num;
647-
perform test.pathman_equal(num::text, '6', 'expected6 child plans for custom scan');
651+
perform test.pathman_equal(num::text, '4', 'expected4 child plans for custom scan');
648652

649-
for i in 0..5 loop
653+
for i in 0..3 loop
650654
perform test.pathman_equal((plan->0->'Plan'->'Plans'->1->'Plans'->i->'Relation Name')::text,
651655
format('"runtime_test_1_%s"', i + 1),
652656
'wrong partition');
@@ -678,11 +682,11 @@ begin
678682
'wrong plan provider');
679683

680684
select count(*) from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans') into num;
681-
perform test.pathman_equal(num::text, '128', 'expected128 child plans for custom scan');
685+
perform test.pathman_equal(num::text, '6', 'expected6 child plans for custom scan');
682686

683-
for i in 0..127 loop
687+
for i in 0..5 loop
684688
num = plan->0->'Plan'->'Plans'->1->'Plans'->i->'Actual Loops';
685-
perform test.pathman_assert(num <=79, 'expected no more than79 loops');
689+
perform test.pathman_assert(num> 0 and num<=1667, 'expected no more than1667 loops');
686690
end loop;
687691

688692
return 'ok';
@@ -694,7 +698,7 @@ declare
694698
num int;
695699
begin
696700
plan = test.pathman_test('select * from test.category c, lateral' ||
697-
'(select * from test.runtime_test_2 g where g.category_id = c.id order by rating limit10) as tg');
701+
'(select * from test.runtime_test_2 g where g.category_id = c.id order by rating limit4) as tg');
698702

699703
perform test.pathman_equal((plan->0->'Plan'->'Node Type')::text,
700704
'"Nested Loop"',
@@ -710,9 +714,9 @@ begin
710714
'wrong plan provider');
711715

712716
select count(*) from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans'->0->'Plans') into num;
713-
perform test.pathman_equal(num::text, '10', 'expected10 child plans for custom scan');
717+
perform test.pathman_equal(num::text, '4', 'expected4 child plans for custom scan');
714718

715-
for i in 0..9 loop
719+
for i in 0..3 loop
716720
perform test.pathman_equal((plan->0->'Plan'->'Plans'->1->'Plans'->0->'Plans'->i->'Relation Name')::text,
717721
format('"runtime_test_2_%s"', i + 1),
718722
'wrong partition');
@@ -727,26 +731,26 @@ $$ language plpgsql;
727731
create table test.run_values as select generate_series(1, 10000) val;
728732
create table test.runtime_test_1(id serial primary key, val real);
729733
insert into test.runtime_test_1 select generate_series(1, 10000), random();
730-
select pathman.create_hash_partitions('test.runtime_test_1', 'id',128);
734+
select pathman.create_hash_partitions('test.runtime_test_1', 'id',6);
731735
NOTICE: function test.runtime_test_1_insert_trigger_func() does not exist, skipping
732736
NOTICE: function test.runtime_test_1_update_trigger_func() does not exist, skipping
733737
NOTICE: Copying data to partitions...
734738
create_hash_partitions
735739
------------------------
736-
128
740+
6
737741
(1 row)
738742

739-
create table test.category as (select id, 'cat' || id::text as name from generate_series(1,10) id);
743+
create table test.category as (select id, 'cat' || id::text as name from generate_series(1,4) id);
740744
create table test.runtime_test_2 (id serial, category_id int not null, name text, rating real);
741-
insert into test.runtime_test_2 (select id, (id %10) + 1 as category_id, 'good' || id::text as name, random() as rating from generate_series(1,1000000) id);
745+
insert into test.runtime_test_2 (select id, (id %6) + 1 as category_id, 'good' || id::text as name, random() as rating from generate_series(1,100000) id);
742746
create index on test.runtime_test_2 (category_id, rating);
743-
select pathman.create_hash_partitions('test.runtime_test_2', 'category_id',128);
747+
select pathman.create_hash_partitions('test.runtime_test_2', 'category_id',6);
744748
NOTICE: function test.runtime_test_2_insert_trigger_func() does not exist, skipping
745749
NOTICE: function test.runtime_test_2_update_trigger_func() does not exist, skipping
746750
NOTICE: Copying data to partitions...
747751
create_hash_partitions
748752
------------------------
749-
128
753+
6
750754
(1 row)
751755

752756
analyze test.run_values;
@@ -784,7 +788,7 @@ set pg_pathman.enable_runtimemergeappend = off;
784788
set enable_mergejoin = on;
785789
set enable_hashjoin = on;
786790
drop table test.run_values, test.runtime_test_1, test.runtime_test_2 cascade;
787-
NOTICE: drop cascades to256 other objects
791+
NOTICE: drop cascades to12 other objects
788792
/*
789793
* Test split and merge
790794
*/

‎sql/pg_pathman.sql

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ begin
205205
performtest.pathman_equal((plan->0->'Plan'->'Plans'->1->'Relation Name')::text,
206206
'"runtime_test_1_1"',
207207
'wrong partition');
208+
209+
selectcount(*)from jsonb_array_elements_text(plan->0->'Plan'->'Plans') into num;
210+
performtest.pathman_equal(num::text,'2','expected 2 child plans for custom scan');
211+
208212
return'ok';
209213
end;
210214
$$ language plpgsql;
@@ -214,7 +218,7 @@ declare
214218
plan jsonb;
215219
numint;
216220
begin
217-
plan=test.pathman_test('select * from test.runtime_test_1 where id = any (select * from test.run_values limit6)');
221+
plan=test.pathman_test('select * from test.runtime_test_1 where id = any (select * from test.run_values limit4)');
218222

219223
performtest.pathman_equal((plan->0->'Plan'->'Node Type')::text,
220224
'"Nested Loop"',
@@ -229,9 +233,9 @@ begin
229233
'wrong plan provider');
230234

231235
selectcount(*)from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans') into num;
232-
performtest.pathman_equal(num::text,'6','expected6 child plans for custom scan');
236+
performtest.pathman_equal(num::text,'4','expected4 child plans for custom scan');
233237

234-
for iin0..5 loop
238+
for iin0..3 loop
235239
performtest.pathman_equal((plan->0->'Plan'->'Plans'->1->'Plans'->i->'Relation Name')::text,
236240
format('"runtime_test_1_%s"', i+1),
237241
'wrong partition');
@@ -264,11 +268,11 @@ begin
264268
'wrong plan provider');
265269

266270
selectcount(*)from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans') into num;
267-
performtest.pathman_equal(num::text,'128','expected128 child plans for custom scan');
271+
performtest.pathman_equal(num::text,'6','expected6 child plans for custom scan');
268272

269-
for iin0..127 loop
273+
for iin0..5 loop
270274
num= plan->0->'Plan'->'Plans'->1->'Plans'->i->'Actual Loops';
271-
performtest.pathman_assert(num<=79,'expected no more than79 loops');
275+
performtest.pathman_assert(num>0and num<=1667,'expected no more than1667 loops');
272276
end loop;
273277

274278
return'ok';
@@ -281,7 +285,7 @@ declare
281285
numint;
282286
begin
283287
plan=test.pathman_test('select * from test.category c, lateral'||
284-
'(select * from test.runtime_test_2 g where g.category_id = c.id order by rating limit10) as tg');
288+
'(select * from test.runtime_test_2 g where g.category_id = c.id order by rating limit4) as tg');
285289

286290
performtest.pathman_equal((plan->0->'Plan'->'Node Type')::text,
287291
'"Nested Loop"',
@@ -297,9 +301,9 @@ begin
297301
'wrong plan provider');
298302

299303
selectcount(*)from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans'->0->'Plans') into num;
300-
performtest.pathman_equal(num::text,'10','expected10 child plans for custom scan');
304+
performtest.pathman_equal(num::text,'4','expected4 child plans for custom scan');
301305

302-
for iin0..9 loop
306+
for iin0..3 loop
303307
performtest.pathman_equal((plan->0->'Plan'->'Plans'->1->'Plans'->0->'Plans'->i->'Relation Name')::text,
304308
format('"runtime_test_2_%s"', i+1),
305309
'wrong partition');
@@ -316,13 +320,13 @@ $$ language plpgsql;
316320
createtabletest.run_valuesasselect generate_series(1,10000) val;
317321
createtabletest.runtime_test_1(idserialprimary key, valreal);
318322
insert intotest.runtime_test_1select generate_series(1,10000), random();
319-
selectpathman.create_hash_partitions('test.runtime_test_1','id',128);
323+
selectpathman.create_hash_partitions('test.runtime_test_1','id',6);
320324

321-
createtabletest.categoryas (select id,'cat'|| id::textas namefrom generate_series(1,10) id);
325+
createtabletest.categoryas (select id,'cat'|| id::textas namefrom generate_series(1,4) id);
322326
createtabletest.runtime_test_2 (idserial, category_idintnot null, nametext, ratingreal);
323-
insert intotest.runtime_test_2 (select id, (id %10)+1as category_id,'good'|| id::textas name, random()as ratingfrom generate_series(1,1000000) id);
327+
insert intotest.runtime_test_2 (select id, (id %6)+1as category_id,'good'|| id::textas name, random()as ratingfrom generate_series(1,100000) id);
324328
createindexontest.runtime_test_2 (category_id, rating);
325-
selectpathman.create_hash_partitions('test.runtime_test_2','category_id',128);
329+
selectpathman.create_hash_partitions('test.runtime_test_2','category_id',6);
326330

327331
analyzetest.run_values;
328332
analyzetest.runtime_test_1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp