mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 19:13:16 +08:00
Modify tests to make more platform agnostic
When testing on Windows these tests were returning differences because of floating point (sql_query_results_*) differences and because the cost was trivially higher (insert_single). Here we remove the costs since it was not relevant to the regressions we want to detect. Further we truncate the floating point averages to 8 decimal places; enough to see significant differences.
This commit is contained in:
parent
0e76b5fa05
commit
00a096f2f6
@ -307,42 +307,42 @@ SELECT * FROM "3dim";
|
||||
(3 rows)
|
||||
|
||||
-- test that explain works
|
||||
EXPLAIN
|
||||
EXPLAIN (COSTS FALSE)
|
||||
INSERT INTO "3dim" VALUES('2017-01-21T09:00:01', 32.9, 'green', 'nyc'),
|
||||
('2017-01-21T09:00:47', 27.3, 'purple', 'la') RETURNING *;
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------
|
||||
Custom Scan (HypertableInsert) (cost=0.00..0.03 rows=2 width=80)
|
||||
-> Insert on "3dim" (cost=0.00..0.03 rows=2 width=80)
|
||||
-> Custom Scan (ChunkDispatch) (cost=0.00..0.03 rows=2 width=80)
|
||||
-> Values Scan on "*VALUES*" (cost=0.00..0.03 rows=2 width=80)
|
||||
---------------------------------------------
|
||||
Custom Scan (HypertableInsert)
|
||||
-> Insert on "3dim"
|
||||
-> Custom Scan (ChunkDispatch)
|
||||
-> Values Scan on "*VALUES*"
|
||||
(4 rows)
|
||||
|
||||
EXPLAIN
|
||||
EXPLAIN (COSTS FALSE)
|
||||
WITH "3dim_insert" AS (
|
||||
INSERT INTO "3dim" VALUES('2017-01-21T09:01:44', 19.3, 'black', 'la') RETURNING time, temp
|
||||
), regular_insert AS (
|
||||
INSERT INTO regular_table VALUES('2017-01-21T10:00:51', 14.3) RETURNING time, temp
|
||||
) INSERT INTO "1dim" (SELECT time, temp FROM "3dim_insert" UNION SELECT time, temp FROM regular_insert);
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Custom Scan (HypertableInsert) (cost=0.09..0.12 rows=2 width=16)
|
||||
-> Insert on "1dim" (cost=0.09..0.12 rows=2 width=16)
|
||||
------------------------------------------------------------------------------
|
||||
Custom Scan (HypertableInsert)
|
||||
-> Insert on "1dim"
|
||||
CTE 3dim_insert
|
||||
-> Custom Scan (HypertableInsert) (cost=0.00..0.01 rows=1 width=80)
|
||||
-> Insert on "3dim" (cost=0.00..0.01 rows=1 width=80)
|
||||
-> Custom Scan (ChunkDispatch) (cost=0.00..0.01 rows=1 width=80)
|
||||
-> Result (cost=0.00..0.01 rows=1 width=80)
|
||||
-> Custom Scan (HypertableInsert)
|
||||
-> Insert on "3dim"
|
||||
-> Custom Scan (ChunkDispatch)
|
||||
-> Result
|
||||
CTE regular_insert
|
||||
-> Insert on regular_table (cost=0.00..0.01 rows=1 width=16)
|
||||
-> Result (cost=0.00..0.01 rows=1 width=16)
|
||||
-> Custom Scan (ChunkDispatch) (cost=0.07..0.09 rows=2 width=16)
|
||||
-> Unique (cost=0.07..0.09 rows=2 width=16)
|
||||
-> Sort (cost=0.07..0.08 rows=2 width=16)
|
||||
-> Insert on regular_table
|
||||
-> Result
|
||||
-> Custom Scan (ChunkDispatch)
|
||||
-> Unique
|
||||
-> Sort
|
||||
Sort Key: "3dim_insert"."time", "3dim_insert".temp
|
||||
-> Append (cost=0.00..0.06 rows=2 width=16)
|
||||
-> CTE Scan on "3dim_insert" (cost=0.00..0.02 rows=1 width=16)
|
||||
-> CTE Scan on regular_insert (cost=0.00..0.02 rows=1 width=16)
|
||||
-> Append
|
||||
-> CTE Scan on "3dim_insert"
|
||||
-> CTE Scan on regular_insert
|
||||
(17 rows)
|
||||
|
||||
-- test prepared statement INSERT
|
||||
|
@ -271,12 +271,12 @@ FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
-> Index Scan using _hyper_1_1_chunk_time_plain on _hyper_1_1_chunk
|
||||
(8 rows)
|
||||
|
||||
SELECT time_bucket('1 minute', time, INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time, INTERVAL '30 seconds') t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
t | avg | min | avg
|
||||
--------------------------+---------+-------+------------------
|
||||
Wed Dec 31 21:32:30 1969 | 19975 | 29950 | 141.332930657636
|
||||
Wed Dec 31 21:31:30 1969 | 19919.5 | 29890 | 141.136445455771
|
||||
t | avg_trunc1 | min | avg_trunc2
|
||||
--------------------------+----------------+-------+--------------
|
||||
Wed Dec 31 21:32:30 1969 | 19975.00000000 | 29950 | 141.33293065
|
||||
Wed Dec 31 21:31:30 1969 | 19919.50000000 | 29890 | 141.13644545
|
||||
(2 rows)
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
@ -293,12 +293,12 @@ FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
-> Index Scan using _hyper_1_1_chunk_time_plain on _hyper_1_1_chunk
|
||||
(8 rows)
|
||||
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
t | avg | min | avg
|
||||
--------------------------+---------+-------+------------------
|
||||
Wed Dec 31 21:32:00 1969 | 19975 | 29950 | 141.332930657636
|
||||
Wed Dec 31 21:31:00 1969 | 19919.5 | 29890 | 141.136445455771
|
||||
t | avg_trunc1 | min | avg_trunc2
|
||||
--------------------------+----------------+-------+--------------
|
||||
Wed Dec 31 21:32:00 1969 | 19975.00000000 | 29950 | 141.33293065
|
||||
Wed Dec 31 21:31:00 1969 | 19919.50000000 | 29890 | 141.13644545
|
||||
(2 rows)
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, avg(series_0), min(series_1), avg(series_2)
|
||||
@ -315,12 +315,12 @@ FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
-> Index Scan using _hyper_1_1_chunk_time_plain on _hyper_1_1_chunk
|
||||
(8 rows)
|
||||
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
t | avg | min | avg
|
||||
--------------------------+---------+-------+------------------
|
||||
Wed Dec 31 21:32:30 1969 | 19975 | 29950 | 141.332930657636
|
||||
Wed Dec 31 21:31:30 1969 | 19919.5 | 29890 | 141.136445455771
|
||||
t | avg_trunc1 | min | avg_trunc2
|
||||
--------------------------+----------------+-------+--------------
|
||||
Wed Dec 31 21:32:30 1969 | 19975.00000000 | 29950 | 141.33293065
|
||||
Wed Dec 31 21:31:30 1969 | 19919.50000000 | 29890 | 141.13644545
|
||||
(2 rows)
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time) t, avg(series_0), min(series_1), avg(series_2)
|
||||
|
@ -278,12 +278,12 @@ FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
-> Seq Scan on _hyper_1_1_chunk
|
||||
(9 rows)
|
||||
|
||||
SELECT time_bucket('1 minute', time, INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time, INTERVAL '30 seconds') t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
t | avg | min | avg
|
||||
--------------------------+---------+-------+------------------
|
||||
Wed Dec 31 21:32:30 1969 | 19975 | 29950 | 141.332930657636
|
||||
Wed Dec 31 21:31:30 1969 | 19919.5 | 29890 | 141.136445455771
|
||||
t | avg_trunc1 | min | avg_trunc2
|
||||
--------------------------+----------------+-------+--------------
|
||||
Wed Dec 31 21:32:30 1969 | 19975.00000000 | 29950 | 141.33293065
|
||||
Wed Dec 31 21:31:30 1969 | 19919.50000000 | 29890 | 141.13644545
|
||||
(2 rows)
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
@ -301,12 +301,12 @@ FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
-> Seq Scan on _hyper_1_1_chunk
|
||||
(9 rows)
|
||||
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
t | avg | min | avg
|
||||
--------------------------+---------+-------+------------------
|
||||
Wed Dec 31 21:32:00 1969 | 19975 | 29950 | 141.332930657636
|
||||
Wed Dec 31 21:31:00 1969 | 19919.5 | 29890 | 141.136445455771
|
||||
t | avg_trunc1 | min | avg_trunc2
|
||||
--------------------------+----------------+-------+--------------
|
||||
Wed Dec 31 21:32:00 1969 | 19975.00000000 | 29950 | 141.33293065
|
||||
Wed Dec 31 21:31:00 1969 | 19919.50000000 | 29890 | 141.13644545
|
||||
(2 rows)
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, avg(series_0), min(series_1), avg(series_2)
|
||||
@ -324,12 +324,12 @@ FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
-> Seq Scan on _hyper_1_1_chunk
|
||||
(9 rows)
|
||||
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
t | avg | min | avg
|
||||
--------------------------+---------+-------+------------------
|
||||
Wed Dec 31 21:32:30 1969 | 19975 | 29950 | 141.332930657636
|
||||
Wed Dec 31 21:31:30 1969 | 19919.5 | 29890 | 141.136445455771
|
||||
t | avg_trunc1 | min | avg_trunc2
|
||||
--------------------------+----------------+-------+--------------
|
||||
Wed Dec 31 21:32:30 1969 | 19975.00000000 | 29950 | 141.33293065
|
||||
Wed Dec 31 21:31:30 1969 | 19919.50000000 | 29890 | 141.13644545
|
||||
(2 rows)
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time) t, avg(series_0), min(series_1), avg(series_2)
|
||||
|
@ -124,18 +124,18 @@ FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time, INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
SELECT time_bucket('1 minute', time, INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time, INTERVAL '30 seconds') t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
|
||||
|
||||
EXPLAIN (costs off) SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, avg(series_0), min(series_1), avg(series_2)
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, avg(series_0), min(series_1), avg(series_2)
|
||||
SELECT time_bucket('1 minute', time - INTERVAL '30 seconds') + INTERVAL '30 seconds' t, trunc(avg(series_0)::numeric, 8) as avg_trunc1, min(series_1), trunc(avg(series_2)::numeric, 8) as avg_trunc2
|
||||
FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2;
|
||||
|
||||
|
||||
|
@ -70,11 +70,11 @@ SELECT * FROM test.show_constraints('_timescaledb_internal._hyper_7_16_chunk');
|
||||
SELECT * FROM "3dim";
|
||||
|
||||
-- test that explain works
|
||||
EXPLAIN
|
||||
EXPLAIN (COSTS FALSE)
|
||||
INSERT INTO "3dim" VALUES('2017-01-21T09:00:01', 32.9, 'green', 'nyc'),
|
||||
('2017-01-21T09:00:47', 27.3, 'purple', 'la') RETURNING *;
|
||||
|
||||
EXPLAIN
|
||||
EXPLAIN (COSTS FALSE)
|
||||
WITH "3dim_insert" AS (
|
||||
INSERT INTO "3dim" VALUES('2017-01-21T09:01:44', 19.3, 'black', 'la') RETURNING time, temp
|
||||
), regular_insert AS (
|
||||
|
Loading…
x
Reference in New Issue
Block a user