mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-22 13:40:56 +08:00
The RangeTblEntry index used during planning might be different from the index used during execution due to flattening. This patch changes ConstraintAwareAppend to handle queries where the index changed between planning and execution.
53 lines
1.6 KiB
MySQL
53 lines
1.6 KiB
MySQL
-- This file and its contents are licensed under the Apache License 2.0.
|
|
-- Please see the included NOTICE for copyright information and
|
|
-- LICENSE-APACHE for a copy of the license.
|
|
|
|
\set TEST_BASE_NAME append
|
|
SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') as "TEST_LOAD_NAME",
|
|
format('include/%s_query.sql', :'TEST_BASE_NAME') as "TEST_QUERY_NAME",
|
|
format('%s/results/%s_results_optimized.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') as "TEST_RESULTS_OPTIMIZED",
|
|
format('%s/results/%s_results_unoptimized.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') as "TEST_RESULTS_UNOPTIMIZED"
|
|
\gset
|
|
SELECT format('\! diff -u --label "Unoptimized results" --label "Optimized results" %s %s', :'TEST_RESULTS_UNOPTIMIZED', :'TEST_RESULTS_OPTIMIZED') as "DIFF_CMD"
|
|
\gset
|
|
|
|
-- look at postgres version to decide whether we run with analyze or without
|
|
SELECT
|
|
CASE WHEN current_setting('server_version_num')::int >= 100000
|
|
THEN 'EXPLAIN (analyze, costs off, timing off, summary off)'
|
|
ELSE 'EXPLAIN (costs off)'
|
|
END AS "PREFIX"
|
|
\gset
|
|
|
|
\ir :TEST_LOAD_NAME
|
|
\ir :TEST_QUERY_NAME
|
|
|
|
--generate the results into two different files
|
|
\set ECHO errors
|
|
SET client_min_messages TO error;
|
|
|
|
\set PREFIX ''
|
|
|
|
-- get results with optimizations disabled
|
|
\o :TEST_RESULTS_UNOPTIMIZED
|
|
SET timescaledb.disable_optimizations TO true;
|
|
\ir :TEST_QUERY_NAME
|
|
\o
|
|
|
|
-- get query results with all optimizations
|
|
\o :TEST_RESULTS_OPTIMIZED
|
|
SET timescaledb.disable_optimizations TO false;
|
|
\ir :TEST_QUERY_NAME
|
|
\o
|
|
|
|
:DIFF_CMD
|
|
|
|
-- get query results with constraint aware append
|
|
\o :TEST_RESULTS_OPTIMIZED
|
|
SET timescaledb.enable_chunk_append TO false;
|
|
\ir :TEST_QUERY_NAME
|
|
\o
|
|
|
|
:DIFF_CMD
|
|
|