mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 02:53:51 +08:00
Ignore dropped chunks in compressed_chunk_stats
This commit is contained in:
parent
57327b52c8
commit
88773323f4
@ -206,7 +206,7 @@ WITH mapq as
|
||||
mapq.compressed_toast_bytes,
|
||||
mapq.compressed_total_bytes
|
||||
FROM _timescaledb_catalog.hypertable as srcht JOIN _timescaledb_catalog.chunk as srcch
|
||||
ON srcht.id = srcch.hypertable_id and srcht.compressed_hypertable_id IS NOT NULL
|
||||
ON srcht.id = srcch.hypertable_id and srcht.compressed_hypertable_id IS NOT NULL and srcch.dropped = false
|
||||
LEFT JOIN mapq
|
||||
ON srcch.id = mapq.chunk_id ;
|
||||
|
||||
|
@ -46,4 +46,3 @@ SELECT * FROM timescaledb_information.hypertable WHERE table_name = 'ht1' ORDER
|
||||
|
||||
-- filter by owner
|
||||
SELECT * FROM timescaledb_information.hypertable WHERE table_owner = 'super_user' ORDER BY table_schema,table_name;
|
||||
|
||||
|
@ -1051,3 +1051,36 @@ ORDER BY constraint_name;
|
||||
_timescaledb_internal | 42_9_hyper_device_id_fkey | _timescaledb_internal | _hyper_18_42_chunk | FOREIGN KEY
|
||||
(1 row)
|
||||
|
||||
-- create hypertable with 2 chunks
|
||||
CREATE TABLE ht5(time TIMESTAMPTZ NOT NULL);
|
||||
SELECT create_hypertable('ht5','time');
|
||||
create_hypertable
|
||||
-------------------
|
||||
(20,public,ht5,t)
|
||||
(1 row)
|
||||
|
||||
INSERT INTO ht5 SELECT '2000-01-01'::TIMESTAMPTZ;
|
||||
INSERT INTO ht5 SELECT '2001-01-01'::TIMESTAMPTZ;
|
||||
-- compressed_chunk_stats should not show dropped chunks
|
||||
ALTER TABLE ht5 SET (timescaledb.compress);
|
||||
SELECT compress_chunk(i) FROM show_chunks('ht5') i;
|
||||
compress_chunk
|
||||
------------------------------------------
|
||||
_timescaledb_internal._hyper_20_45_chunk
|
||||
_timescaledb_internal._hyper_20_46_chunk
|
||||
(2 rows)
|
||||
|
||||
SELECT drop_chunks(table_name => 'ht5', newer_than => '2000-01-01'::TIMESTAMPTZ);
|
||||
drop_chunks
|
||||
------------------------------------------
|
||||
_timescaledb_internal._hyper_20_46_chunk
|
||||
(1 row)
|
||||
|
||||
SELECT chunk_name
|
||||
FROM timescaledb_information.compressed_chunk_stats
|
||||
WHERE hypertable_name = 'ht5'::regclass;
|
||||
chunk_name
|
||||
------------------------------------------
|
||||
_timescaledb_internal._hyper_20_45_chunk
|
||||
(1 row)
|
||||
|
||||
|
@ -418,3 +418,17 @@ SELECT constraint_schema, constraint_name, table_schema, table_name, constraint_
|
||||
FROM information_schema.table_constraints
|
||||
WHERE table_name = :'CHUNK_NAME' AND constraint_type = 'FOREIGN KEY'
|
||||
ORDER BY constraint_name;
|
||||
|
||||
-- create hypertable with 2 chunks
|
||||
CREATE TABLE ht5(time TIMESTAMPTZ NOT NULL);
|
||||
SELECT create_hypertable('ht5','time');
|
||||
INSERT INTO ht5 SELECT '2000-01-01'::TIMESTAMPTZ;
|
||||
INSERT INTO ht5 SELECT '2001-01-01'::TIMESTAMPTZ;
|
||||
|
||||
-- compressed_chunk_stats should not show dropped chunks
|
||||
ALTER TABLE ht5 SET (timescaledb.compress);
|
||||
SELECT compress_chunk(i) FROM show_chunks('ht5') i;
|
||||
SELECT drop_chunks(table_name => 'ht5', newer_than => '2000-01-01'::TIMESTAMPTZ);
|
||||
SELECT chunk_name
|
||||
FROM timescaledb_information.compressed_chunk_stats
|
||||
WHERE hypertable_name = 'ht5'::regclass;
|
||||
|
Loading…
x
Reference in New Issue
Block a user