mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-23 06:22:03 +08:00
Set toast_tuple_target to 128B when able
We want compressed data to be stored out-of-line whenever possible so that the headers are colocated and scans on the metadata and segmentbys are cheap. This commit lowers toast_tuple_target to 128 bytes, so that more tables will have this occur; using the default size, very often a non-trivial portion of the data ends up in the main table, and only very few rows are stored in a page.
This commit is contained in:
parent
e9e7c5f38e
commit
48ef701fa9
@ -495,6 +495,26 @@ set_statistics_on_compressed_table(Oid compressed_table_id)
|
||||
RelationClose(table_rel);
|
||||
}
|
||||
|
||||
#if !PG96 && !PG10
|
||||
static void
|
||||
set_toast_tuple_target_on_compressed(Oid compressed_table_id)
|
||||
{
|
||||
DefElem def_elem = {
|
||||
.type = T_DefElem,
|
||||
.defname = "toast_tuple_target",
|
||||
.arg = (Node *) makeInteger(128),
|
||||
.defaction = DEFELEM_SET,
|
||||
.location = -1,
|
||||
};
|
||||
AlterTableCmd cmd = {
|
||||
.type = T_AlterTableCmd,
|
||||
.subtype = AT_SetRelOptions,
|
||||
.def = (Node *) list_make1(&def_elem),
|
||||
};
|
||||
AlterTableInternal(compressed_table_id, list_make1(&cmd), true);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32
|
||||
create_compression_table(Oid owner, CompressColInfo *compress_cols)
|
||||
{
|
||||
@ -540,6 +560,10 @@ create_compression_table(Oid owner, CompressColInfo *compress_cols)
|
||||
|
||||
set_statistics_on_compressed_table(compress_relid);
|
||||
|
||||
#if !PG96 && !PG10
|
||||
set_toast_tuple_target_on_compressed(compress_relid);
|
||||
#endif
|
||||
|
||||
create_compressed_table_indexes(compress_relid, compress_cols);
|
||||
return compress_hypertable_id;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user