|
| 1 | +SET statement_timeout = 5000; -- [0.8s] |
| 2 | +DROP TABLE IF EXISTS a,b CASCADE; |
| 3 | +NOTICE: table "a" does not exist, skipping |
| 4 | +NOTICE: table "b" does not exist, skipping |
| 5 | +CREATE TABLE a (x int); |
| 6 | +INSERT INTO a (x) SELECT mod(ival,10) FROM generate_series(1,1000) As ival; |
| 7 | +CREATE TABLE b (y int); |
| 8 | +INSERT INTO b (y) SELECT mod(ival + 1,10) FROM generate_series(1,1000) As ival; |
| 9 | +CREATE EXTENSION IF NOT EXISTS aqo; |
| 10 | +SET aqo.join_threshold = 0; |
| 11 | +SET aqo.mode = 'learn'; |
| 12 | +SET aqo.show_details = 'off'; |
| 13 | +SET aqo.learn_statement_timeout = 'on'; |
| 14 | +SET aqo.statement_timeout = 4; -- [0.8s] |
| 15 | +SELECT count(y), pg_sleep(3) FROM a,b where x > 2 * (select min(x) from A,B where x = y); |
| 16 | +NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data. Current timeout is 4, mean integral error is 0.000000 |
| 17 | + count | pg_sleep |
| 18 | +--------+---------- |
| 19 | + 900000 | |
| 20 | +(1 row) |
| 21 | + |
| 22 | +select * from aqo_queries where query_hash <> 0; |
| 23 | + query_hash | learn_aqo | use_aqo | fspace_hash | auto_tuning | flex_timeout | count_increase_timeout |
| 24 | +-------------------+-----------+---------+-------------------+-------------+--------------+------------------------ |
| 25 | + 42929091640608990 | t | t | 42929091640608990 | f | 5 | 1 |
| 26 | +(1 row) |
| 27 | + |
| 28 | +SELECT count(y), pg_sleep(3) FROM a,b where x > 3 * (select min(x) from A,B where x = y); |
| 29 | +NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data. Current timeout is 4, mean integral error is 0.866297 |
| 30 | + count | pg_sleep |
| 31 | +--------+---------- |
| 32 | + 900000 | |
| 33 | +(1 row) |
| 34 | + |
| 35 | +select * from aqo_queries where query_hash <> 0; |
| 36 | + query_hash | learn_aqo | use_aqo | fspace_hash | auto_tuning | flex_timeout | count_increase_timeout |
| 37 | +-------------------+-----------+---------+-------------------+-------------+--------------+------------------------ |
| 38 | + 42929091640608990 | t | t | 42929091640608990 | f | 5 | 1 |
| 39 | +(1 row) |
| 40 | + |
| 41 | +SELECT count(y), pg_sleep(3) FROM a,b where x > 3 * (select min(x) from A,B where x = y); |
| 42 | +NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data. Current timeout is 4, mean integral error is 0.435709 |
| 43 | + count | pg_sleep |
| 44 | +--------+---------- |
| 45 | + 900000 | |
| 46 | +(1 row) |
| 47 | + |
| 48 | +select * from aqo_queries where query_hash <> 0; |
| 49 | + query_hash | learn_aqo | use_aqo | fspace_hash | auto_tuning | flex_timeout | count_increase_timeout |
| 50 | +-------------------+-----------+---------+-------------------+-------------+--------------+------------------------ |
| 51 | + 42929091640608990 | t | t | 42929091640608990 | f | 5 | 1 |
| 52 | +(1 row) |
| 53 | + |
| 54 | +SELECT count(y), pg_sleep(3) FROM a,b where x > (select min(x) from A,B where x = y); |
| 55 | +NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data. Current timeout is 4, mean integral error is 0.000000 |
| 56 | + count | pg_sleep |
| 57 | +--------+---------- |
| 58 | + 900000 | |
| 59 | +(1 row) |
| 60 | + |
| 61 | +select * from aqo_queries where query_hash <> 0; |
| 62 | + query_hash | learn_aqo | use_aqo | fspace_hash | auto_tuning | flex_timeout | count_increase_timeout |
| 63 | +---------------------+-----------+---------+---------------------+-------------+--------------+------------------------ |
| 64 | + 42929091640608990 | t | t | 42929091640608990 | f | 5 | 1 |
| 65 | + 6582036157989373325 | t | t | 6582036157989373325 | f | 20 | 2 |
| 66 | +(2 rows) |
| 67 | + |
| 68 | +SELECT count(y), pg_sleep(3) FROM a,b where x > (select min(x) from A,B where x = y); |
| 69 | +NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data. Current timeout is 4, mean integral error is 0.866297 |
| 70 | + count | pg_sleep |
| 71 | +--------+---------- |
| 72 | + 900000 | |
| 73 | +(1 row) |
| 74 | + |
| 75 | +select * from aqo_queries where query_hash <> 0; |
| 76 | + query_hash | learn_aqo | use_aqo | fspace_hash | auto_tuning | flex_timeout | count_increase_timeout |
| 77 | +---------------------+-----------+---------+---------------------+-------------+--------------+------------------------ |
| 78 | + 42929091640608990 | t | t | 42929091640608990 | f | 5 | 1 |
| 79 | + 6582036157989373325 | t | t | 6582036157989373325 | f | 20 | 2 |
| 80 | +(2 rows) |
| 81 | + |
| 82 | +SELECT count(y), pg_sleep(3) FROM a,b where x > (select min(x) from A,B where x = y); |
| 83 | +NOTICE: [AQO] Time limit for execution of the statement was expired. AQO tried to learn on partial data. Current timeout is 4, mean integral error is 0.435709 |
| 84 | + count | pg_sleep |
| 85 | +--------+---------- |
| 86 | + 900000 | |
| 87 | +(1 row) |
| 88 | + |
| 89 | +select * from aqo_queries where query_hash <> 0; |
| 90 | + query_hash | learn_aqo | use_aqo | fspace_hash | auto_tuning | flex_timeout | count_increase_timeout |
| 91 | +---------------------+-----------+---------+---------------------+-------------+--------------+------------------------ |
| 92 | + 42929091640608990 | t | t | 42929091640608990 | f | 5 | 1 |
| 93 | + 6582036157989373325 | t | t | 6582036157989373325 | f | 20 | 2 |
| 94 | +(2 rows) |
| 95 | + |
| 96 | +DROP EXTENSION aqo; |