@@ -1755,35 +1755,18 @@ SELECT compress_chunk(i) FROM show_chunks('f_sensor_data') i;
1755
1755
1756
1756
VACUUM ANALYZE f_sensor_data;
1757
1757
-- Encourage use of parallel plans
1758
+ SET max_parallel_workers_per_gather = 4;
1759
+ SET min_parallel_index_scan_size = 0;
1760
+ SET min_parallel_table_scan_size = 0;
1758
1761
SET parallel_setup_cost = 0;
1759
1762
SET parallel_tuple_cost = 0;
1760
- SET min_parallel_table_scan_size TO '0';
1761
- \set explain 'EXPLAIN (VERBOSE, COSTS OFF)'
1762
- SHOW min_parallel_table_scan_size;
1763
- min_parallel_table_scan_size
1764
- ------------------------------
1765
- 0
1766
- (1 row)
1767
-
1768
1763
SHOW max_parallel_workers;
1769
1764
max_parallel_workers
1770
1765
----------------------
1771
1766
8
1772
1767
(1 row)
1773
1768
1774
- SHOW max_parallel_workers_per_gather;
1775
- max_parallel_workers_per_gather
1776
- ---------------------------------
1777
- 2
1778
- (1 row)
1779
-
1780
- SET max_parallel_workers_per_gather = 4;
1781
- SHOW max_parallel_workers_per_gather;
1782
- max_parallel_workers_per_gather
1783
- ---------------------------------
1784
- 4
1785
- (1 row)
1786
-
1769
+ \set explain 'EXPLAIN (VERBOSE, COSTS OFF)'
1787
1770
-- We disable enable_parallel_append here to ensure
1788
1771
-- that we create the same query plan in all PG 14.X versions
1789
1772
SET enable_parallel_append = false;
@@ -1805,24 +1788,19 @@ SELECT sum(cpu) FROM f_sensor_data;
1805
1788
Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature
1806
1789
(12 rows)
1807
1790
1808
- -- Encourage use of Index Scan
1809
- SET enable_seqscan = false;
1810
- SET enable_indexscan = true;
1811
- SET min_parallel_index_scan_size = 0;
1812
- SET min_parallel_table_scan_size = 0;
1813
1791
CREATE INDEX ON f_sensor_data (time, sensor_id);
1814
1792
:explain
1815
- SELECT * FROM f_sensor_data WHERE sensor_id > 100 ;
1793
+ SELECT * FROM f_sensor_data WHERE sensor_id > 1000 ;
1816
1794
QUERY PLAN
1817
1795
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1818
1796
Gather
1819
1797
Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature
1820
- Workers Planned: 3
1798
+ Workers Planned: 2
1821
1799
-> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_37_73_chunk
1822
1800
Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature
1823
1801
-> Parallel Index Scan using compress_hyper_38_74_chunk_sensor_id__ts_meta_min_1__ts_met_idx on _timescaledb_internal.compress_hyper_38_74_chunk
1824
1802
Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature
1825
- Index Cond: (compress_hyper_38_74_chunk.sensor_id > 100 )
1803
+ Index Cond: (compress_hyper_38_74_chunk.sensor_id > 1000 )
1826
1804
(8 rows)
1827
1805
1828
1806
RESET enable_parallel_append;
@@ -1841,26 +1819,29 @@ ORDER BY
1841
1819
VACUUM ANALYZE f_sensor_data;
1842
1820
:explain
1843
1821
SELECT sum(cpu) FROM f_sensor_data;
1844
- QUERY PLAN
1845
- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1822
+ QUERY PLAN
1823
+ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1846
1824
Finalize Aggregate
1847
1825
Output: sum(_hyper_37_73_chunk.cpu)
1848
- -> Append
1849
- -> Custom Scan (VectorAgg)
1850
- Output: (PARTIAL sum(_hyper_37_73_chunk.cpu))
1851
- Grouping Policy: all compressed batches
1852
- -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_37_73_chunk
1853
- Output: _hyper_37_73_chunk.cpu
1854
- -> Seq Scan on _timescaledb_internal.compress_hyper_38_74_chunk
1855
- Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature
1856
- -> Partial Aggregate
1857
- Output: PARTIAL sum(_hyper_37_73_chunk.cpu)
1858
- -> Seq Scan on _timescaledb_internal._hyper_37_73_chunk
1859
- Output: _hyper_37_73_chunk.cpu
1860
- (14 rows)
1826
+ -> Gather
1827
+ Output: (PARTIAL sum(_hyper_37_73_chunk.cpu))
1828
+ Workers Planned: 4
1829
+ -> Parallel Append
1830
+ -> Custom Scan (VectorAgg)
1831
+ Output: (PARTIAL sum(_hyper_37_73_chunk.cpu))
1832
+ Grouping Policy: all compressed batches
1833
+ -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_37_73_chunk
1834
+ Output: _hyper_37_73_chunk.cpu
1835
+ -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_38_74_chunk
1836
+ Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature
1837
+ -> Partial Aggregate
1838
+ Output: PARTIAL sum(_hyper_37_73_chunk.cpu)
1839
+ -> Parallel Seq Scan on _timescaledb_internal._hyper_37_73_chunk
1840
+ Output: _hyper_37_73_chunk.cpu
1841
+ (17 rows)
1861
1842
1862
1843
:explain
1863
- SELECT * FROM f_sensor_data WHERE sensor_id > 100 ;
1844
+ SELECT * FROM f_sensor_data WHERE sensor_id > 1000 ;
1864
1845
QUERY PLAN
1865
1846
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1866
1847
Gather
@@ -1869,13 +1850,13 @@ SELECT * FROM f_sensor_data WHERE sensor_id > 100;
1869
1850
-> Parallel Append
1870
1851
-> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_37_73_chunk
1871
1852
Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature
1872
- Filter: (_hyper_37_73_chunk.sensor_id > 100 )
1853
+ Filter: (_hyper_37_73_chunk.sensor_id > 1000 )
1873
1854
-> Parallel Index Scan using compress_hyper_38_74_chunk_sensor_id__ts_meta_min_1__ts_met_idx on _timescaledb_internal.compress_hyper_38_74_chunk
1874
1855
Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature
1875
- Index Cond: (compress_hyper_38_74_chunk.sensor_id > 100 )
1876
- -> Parallel Index Scan using _hyper_37_73_chunk_f_sensor_data_time_sensor_id_idx on _timescaledb_internal._hyper_37_73_chunk
1856
+ Index Cond: (compress_hyper_38_74_chunk.sensor_id > 1000 )
1857
+ -> Parallel Seq Scan on _timescaledb_internal._hyper_37_73_chunk
1877
1858
Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature
1878
- Index Cond : (_hyper_37_73_chunk.sensor_id > 100 )
1859
+ Filter : (_hyper_37_73_chunk.sensor_id > 1000 )
1879
1860
(13 rows)
1880
1861
1881
1862
-- Test non-partial paths below append are not executed multiple times
@@ -1961,34 +1942,25 @@ SELECT * FROM ht_metrics_partially_compressed ORDER BY time DESC, device LIMIT 1
1961
1942
QUERY PLAN
1962
1943
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1963
1944
Limit
1964
- Output: ht_metrics_partially_compressed."time", ht_metrics_partially_compressed.device, ht_metrics_partially_compressed.value
1965
- -> Custom Scan (ChunkAppend) on public.ht_metrics_partially_compressed
1966
- Output: ht_metrics_partially_compressed."time", ht_metrics_partially_compressed.device, ht_metrics_partially_compressed.value
1967
- Order: ht_metrics_partially_compressed."time" DESC, ht_metrics_partially_compressed.device
1968
- Startup Exclusion: false
1969
- Runtime Exclusion: false
1945
+ Output: _hyper_41_78_chunk."time", _hyper_41_78_chunk.device, _hyper_41_78_chunk.value
1946
+ -> Gather Merge
1947
+ Output: _hyper_41_78_chunk."time", _hyper_41_78_chunk.device, _hyper_41_78_chunk.value
1948
+ Workers Planned: 2
1970
1949
-> Sort
1971
1950
Output: _hyper_41_78_chunk."time", _hyper_41_78_chunk.device, _hyper_41_78_chunk.value
1972
1951
Sort Key: _hyper_41_78_chunk."time" DESC, _hyper_41_78_chunk.device
1973
- -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_41_78_chunk
1974
- Output: _hyper_41_78_chunk."time", _hyper_41_78_chunk.device, _hyper_41_78_chunk.value
1975
- -> Seq Scan on _timescaledb_internal.compress_hyper_42_80_chunk
1976
- Output: compress_hyper_42_80_chunk._ts_meta_count, compress_hyper_42_80_chunk.device, compress_hyper_42_80_chunk._ts_meta_min_1, compress_hyper_42_80_chunk._ts_meta_max_1, compress_hyper_42_80_chunk."time", compress_hyper_42_80_chunk.value
1977
- -> Merge Append
1978
- Sort Key: _hyper_41_77_chunk."time" DESC, _hyper_41_77_chunk.device
1979
- -> Sort
1980
- Output: _hyper_41_77_chunk."time", _hyper_41_77_chunk.device, _hyper_41_77_chunk.value
1981
- Sort Key: _hyper_41_77_chunk."time" DESC, _hyper_41_77_chunk.device
1952
+ -> Parallel Append
1953
+ -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_41_78_chunk
1954
+ Output: _hyper_41_78_chunk."time", _hyper_41_78_chunk.device, _hyper_41_78_chunk.value
1955
+ -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_42_80_chunk
1956
+ Output: compress_hyper_42_80_chunk._ts_meta_count, compress_hyper_42_80_chunk.device, compress_hyper_42_80_chunk._ts_meta_min_1, compress_hyper_42_80_chunk._ts_meta_max_1, compress_hyper_42_80_chunk."time", compress_hyper_42_80_chunk.value
1982
1957
-> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_41_77_chunk
1983
1958
Output: _hyper_41_77_chunk."time", _hyper_41_77_chunk.device, _hyper_41_77_chunk.value
1984
- -> Seq Scan on _timescaledb_internal.compress_hyper_42_79_chunk
1959
+ -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_42_79_chunk
1985
1960
Output: compress_hyper_42_79_chunk._ts_meta_count, compress_hyper_42_79_chunk.device, compress_hyper_42_79_chunk._ts_meta_min_1, compress_hyper_42_79_chunk._ts_meta_max_1, compress_hyper_42_79_chunk."time", compress_hyper_42_79_chunk.value
1986
- -> Sort
1987
- Output: _hyper_41_77_chunk."time", _hyper_41_77_chunk.device, _hyper_41_77_chunk.value
1988
- Sort Key: _hyper_41_77_chunk."time" DESC, _hyper_41_77_chunk.device
1989
- -> Seq Scan on _timescaledb_internal._hyper_41_77_chunk
1961
+ -> Parallel Seq Scan on _timescaledb_internal._hyper_41_77_chunk
1990
1962
Output: _hyper_41_77_chunk."time", _hyper_41_77_chunk.device, _hyper_41_77_chunk.value
1991
- (28 rows)
1963
+ (19 rows)
1992
1964
1993
1965
-- Test parameter change on rescan
1994
1966
-- issue 6069
0 commit comments