diff options
Diffstat (limited to 'contrib/postgres_fdw/sql')
-rw-r--r-- | contrib/postgres_fdw/sql/query_cancel.sql | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/postgres_fdw/sql/query_cancel.sql b/contrib/postgres_fdw/sql/query_cancel.sql index 8f11f3f9a6a..270e129d77e 100644 --- a/contrib/postgres_fdw/sql/query_cancel.sql +++ b/contrib/postgres_fdw/sql/query_cancel.sql @@ -3,10 +3,18 @@ SELECT version() ~ 'cygwin' AS skip_test \gset \quit \endif --- Make sure this big CROSS JOIN query is pushed down -EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5; --- Make sure query cancellation works +-- Let's test canceling a remote query. Use a table that does not have +-- remote_estimate enabled, else there will be multiple queries to the +-- remote and we might unluckily send the cancel in between two of them. +-- First let's confirm that the query is actually pushed down. +EXPLAIN (VERBOSE, COSTS OFF) +SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d; + BEGIN; -SET LOCAL statement_timeout = '10ms'; -select count(*) from ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5; -- this takes very long +-- Make sure that connection is open and set up. +SELECT count(*) FROM ft1 a; +-- Timeout needs to be long enough to be sure that we've sent the slow query. +SET LOCAL statement_timeout = '100ms'; +-- This would take very long if not canceled: +SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d; COMMIT; |