Skip to content

Commit

Permalink
Reduce the size of data for analyze tests.
Browse files Browse the repository at this point in the history
Instead of generating a large dataset to force usage of indexes, disable
sequential scan and use a smaller data set.

Fixes #6316
  • Loading branch information
vpetrovykh committed Jan 5, 2024
1 parent 09a7f94 commit 2caca1e
Show file tree
Hide file tree
Showing 2 changed files with 645 additions and 536 deletions.
18 changes: 13 additions & 5 deletions tests/schemas/explain_setup.edgeql
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,18 @@ SET {
};


# Make the database more populated so that it uses indexes...
for i in range_unpack(range(1, 1000)) union (
# Add a function that disables sequential scan.
create function _set_seqscan(val: std::str) -> std::str {
using sql $$
select set_config('enable_seqscan', val, true)
$$;
};


# Generate some data ...
for i in range_unpack(range(1, 10)) union (
with u := (insert User { name := <str>i }),
for j in range_unpack(range(0, 5)) union (
for j in range_unpack(range(0, 3)) union (
insert Issue {
owner := u,
number := <str>(i*100 + j),
Expand All @@ -150,7 +158,7 @@ update User set {
};


for x in range_unpack(range(0, 900_000)) union (
for x in range_unpack(range(0, 100)) union (
insert RangeTest {
rval := range(-(x * 101419 % 307), x * 201881 % 307),
mval := multirange([
Expand Down Expand Up @@ -181,7 +189,7 @@ for x in range_unpack(range(0, 900_000)) union (
);


for x in range_unpack(range(0, 100_000)) union (
for x in range_unpack(range(0, 100)) union (
insert JSONTest{val := <json>(a:=x, b:=x * 40123 % 10007)}
);

Expand Down
Loading

0 comments on commit 2caca1e

Please sign in to comment.