mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 19:13:16 +08:00
Add the type for min/max segment meta object. Segment metadata objects keep metadata about data in segments (compressed rows). The min/max variant keeps the min and max values inside the compressed object. It will be used on compression order by columns to allow queries that have quals on those columns to be able to exclude entire segments if no uncompressed rows in the segment may match the qual. We also add generalized infrastructure for datum serialization / deserialization for arbitrary types to and from memory as well as binary strings.
29 lines
899 B
SQL
29 lines
899 B
SQL
-- This file and its contents are licensed under the Timescale License.
|
|
-- Please see the included NOTICE for copyright information and
|
|
-- LICENSE-TIMESCALE for a copy of the license.
|
|
|
|
\set ECHO errors
|
|
|
|
SELECT 'NULL::'||:'TYPE' as "NULLTYPE" \gset
|
|
|
|
SELECT
|
|
_timescaledb_internal.segment_meta_min_max_agg(i)::text as "META_TEXT",
|
|
min(i) as "TRUE_MIN",
|
|
max(i) as "TRUE_MAX",
|
|
(count(*)-count(i)) > 0 as "TRUE_HAS_NULL"
|
|
FROM :"TABLE" \gset
|
|
|
|
SELECT
|
|
_timescaledb_internal.segment_meta_min_max_get_min(meta, :NULLTYPE) = :'TRUE_MIN' as min_correct,
|
|
_timescaledb_internal.segment_meta_min_max_get_max(meta, :NULLTYPE) = :'TRUE_MAX' as max_correct,
|
|
_timescaledb_internal.segment_meta_min_max_has_null(meta) = :'TRUE_HAS_NULL' as has_null_correct
|
|
FROM
|
|
(
|
|
SELECT
|
|
:'META_TEXT'::_timescaledb_internal.segment_meta_min_max as meta
|
|
) AS meta_gen;
|
|
|
|
|
|
|
|
\set ECHO all
|