mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-16 18:43:18 +08:00
Adds a move_chunk function which to a different tablespace. This is implemented as an extension to the reorder command. Given that the heap, toast tables, and indexes are being rewritten during the reorder operation, adding the ability to modify the tablespace is relatively simple and mostly requires adding parameters to the relevant functions for the destination tablespace (and index tablespace). The tests do not focus on further exercising the reorder infrastructure, but instead ensure that tablespace movement and permissions checks properly occur.
21 lines
793 B
SQL
21 lines
793 B
SQL
-- This file and its contents are licensed under the Apache License 2.0.
|
|
-- Please see the included NOTICE for copyright information and
|
|
-- LICENSE-APACHE for a copy of the license.
|
|
|
|
-- chunk - the OID of the chunk to be CLUSTERed
|
|
-- index - the OID of the index to be CLUSTERed on, or NULL to use the index
|
|
-- last used
|
|
CREATE OR REPLACE FUNCTION reorder_chunk(
|
|
chunk REGCLASS,
|
|
index REGCLASS=NULL,
|
|
verbose BOOLEAN=FALSE
|
|
) RETURNS VOID AS '@MODULE_PATHNAME@', 'ts_reorder_chunk' LANGUAGE C VOLATILE;
|
|
|
|
CREATE OR REPLACE FUNCTION move_chunk(
|
|
chunk REGCLASS,
|
|
destination_tablespace Name,
|
|
index_destination_tablespace Name=NULL,
|
|
reorder_index REGCLASS=NULL,
|
|
verbose BOOLEAN=FALSE
|
|
) RETURNS VOID AS '@MODULE_PATHNAME@', 'ts_move_chunk' LANGUAGE C VOLATILE;
|