mirror of https://github.com/citusdata/citus.git
rename UDFs also
parent
a2b698a766
commit
91015deb9d
|
@ -1266,11 +1266,11 @@ columnar_handler(PG_FUNCTION_ARGS)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* alter_cstore_table_set is a UDF exposed in postgres to change settings on a columnar
|
* alter_columnar_table_set is a UDF exposed in postgres to change settings on a columnar
|
||||||
* table. Calling this function on a non-columnar table gives an error.
|
* table. Calling this function on a non-columnar table gives an error.
|
||||||
*
|
*
|
||||||
* sql syntax:
|
* sql syntax:
|
||||||
* pg_catalog.alter_cstore_table_set(
|
* pg_catalog.alter_columnar_table_set(
|
||||||
* table_name regclass,
|
* table_name regclass,
|
||||||
* block_row_count int DEFAULT NULL,
|
* block_row_count int DEFAULT NULL,
|
||||||
* stripe_row_count int DEFAULT NULL,
|
* stripe_row_count int DEFAULT NULL,
|
||||||
|
@ -1278,16 +1278,16 @@ columnar_handler(PG_FUNCTION_ARGS)
|
||||||
*
|
*
|
||||||
* All arguments except the table name are optional. The UDF is supposed to be called
|
* All arguments except the table name are optional. The UDF is supposed to be called
|
||||||
* like:
|
* like:
|
||||||
* SELECT alter_cstore_table_set('table', compression => 'pglz');
|
* SELECT alter_columnar_table_set('table', compression => 'pglz');
|
||||||
*
|
*
|
||||||
* This will only update the compression of the table, keeping all other settings the
|
* This will only update the compression of the table, keeping all other settings the
|
||||||
* same. Multiple settings can be changed at the same time by providing multiple
|
* same. Multiple settings can be changed at the same time by providing multiple
|
||||||
* arguments. Calling the argument with the NULL value will be interperted as not having
|
* arguments. Calling the argument with the NULL value will be interperted as not having
|
||||||
* provided the argument.
|
* provided the argument.
|
||||||
*/
|
*/
|
||||||
PG_FUNCTION_INFO_V1(alter_cstore_table_set);
|
PG_FUNCTION_INFO_V1(alter_columnar_table_set);
|
||||||
Datum
|
Datum
|
||||||
alter_cstore_table_set(PG_FUNCTION_ARGS)
|
alter_columnar_table_set(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
Oid relationId = PG_GETARG_OID(0);
|
Oid relationId = PG_GETARG_OID(0);
|
||||||
|
|
||||||
|
@ -1340,9 +1340,9 @@ alter_cstore_table_set(PG_FUNCTION_ARGS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PG_FUNCTION_INFO_V1(alter_cstore_table_reset);
|
PG_FUNCTION_INFO_V1(alter_columnar_table_reset);
|
||||||
Datum
|
Datum
|
||||||
alter_cstore_table_reset(PG_FUNCTION_ARGS)
|
alter_columnar_table_reset(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
Oid relationId = PG_GETARG_OID(0);
|
Oid relationId = PG_GETARG_OID(0);
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,8 @@ BEGIN
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
#include "udfs/columnar_handler/10.0-1.sql"
|
#include "udfs/columnar_handler/10.0-1.sql"
|
||||||
#include "udfs/alter_cstore_table_set/10.0-1.sql"
|
#include "udfs/alter_columnar_table_set/10.0-1.sql"
|
||||||
#include "udfs/alter_cstore_table_reset/10.0-1.sql"
|
#include "udfs/alter_columnar_table_reset/10.0-1.sql"
|
||||||
$$;
|
$$;
|
||||||
END IF;
|
END IF;
|
||||||
END$proc$;
|
END$proc$;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_reset(
|
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count bool DEFAULT false,
|
block_row_count bool DEFAULT false,
|
||||||
stripe_row_count bool DEFAULT false,
|
stripe_row_count bool DEFAULT false,
|
||||||
compression bool DEFAULT false)
|
compression bool DEFAULT false)
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C
|
LANGUAGE C
|
||||||
AS 'MODULE_PATHNAME', 'alter_cstore_table_reset';
|
AS 'MODULE_PATHNAME', 'alter_columnar_table_reset';
|
||||||
|
|
||||||
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_reset(
|
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count bool,
|
block_row_count bool,
|
||||||
stripe_row_count bool,
|
stripe_row_count bool,
|
|
@ -1,13 +1,13 @@
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_reset(
|
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count bool DEFAULT false,
|
block_row_count bool DEFAULT false,
|
||||||
stripe_row_count bool DEFAULT false,
|
stripe_row_count bool DEFAULT false,
|
||||||
compression bool DEFAULT false)
|
compression bool DEFAULT false)
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C
|
LANGUAGE C
|
||||||
AS 'MODULE_PATHNAME', 'alter_cstore_table_reset';
|
AS 'MODULE_PATHNAME', 'alter_columnar_table_reset';
|
||||||
|
|
||||||
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_reset(
|
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count bool,
|
block_row_count bool,
|
||||||
stripe_row_count bool,
|
stripe_row_count bool,
|
|
@ -1,13 +1,13 @@
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_set(
|
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_set(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count int DEFAULT NULL,
|
block_row_count int DEFAULT NULL,
|
||||||
stripe_row_count int DEFAULT NULL,
|
stripe_row_count int DEFAULT NULL,
|
||||||
compression name DEFAULT null)
|
compression name DEFAULT null)
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C
|
LANGUAGE C
|
||||||
AS 'MODULE_PATHNAME', 'alter_cstore_table_set';
|
AS 'MODULE_PATHNAME', 'alter_columnar_table_set';
|
||||||
|
|
||||||
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_set(
|
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_set(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count int,
|
block_row_count int,
|
||||||
stripe_row_count int,
|
stripe_row_count int,
|
|
@ -1,13 +1,13 @@
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_set(
|
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_set(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count int DEFAULT NULL,
|
block_row_count int DEFAULT NULL,
|
||||||
stripe_row_count int DEFAULT NULL,
|
stripe_row_count int DEFAULT NULL,
|
||||||
compression name DEFAULT null)
|
compression name DEFAULT null)
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C
|
LANGUAGE C
|
||||||
AS 'MODULE_PATHNAME', 'alter_cstore_table_set';
|
AS 'MODULE_PATHNAME', 'alter_columnar_table_set';
|
||||||
|
|
||||||
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_set(
|
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_set(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count int,
|
block_row_count int,
|
||||||
stripe_row_count int,
|
stripe_row_count int,
|
|
@ -20,9 +20,9 @@ IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
|
||||||
|
|
||||||
#include "../columnar_handler/10.0-1.sql"
|
#include "../columnar_handler/10.0-1.sql"
|
||||||
|
|
||||||
#include "../alter_cstore_table_set/10.0-1.sql"
|
#include "../alter_columnar_table_set/10.0-1.sql"
|
||||||
|
|
||||||
#include "../alter_cstore_table_reset/10.0-1.sql"
|
#include "../alter_columnar_table_reset/10.0-1.sql"
|
||||||
|
|
||||||
-- add the missing objects to the extension
|
-- add the missing objects to the extension
|
||||||
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);
|
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);
|
||||||
|
|
|
@ -20,9 +20,9 @@ IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
|
||||||
|
|
||||||
#include "../columnar_handler/10.0-1.sql"
|
#include "../columnar_handler/10.0-1.sql"
|
||||||
|
|
||||||
#include "../alter_cstore_table_set/10.0-1.sql"
|
#include "../alter_columnar_table_set/10.0-1.sql"
|
||||||
|
|
||||||
#include "../alter_cstore_table_reset/10.0-1.sql"
|
#include "../alter_columnar_table_reset/10.0-1.sql"
|
||||||
|
|
||||||
-- add the missing objects to the extension
|
-- add the missing objects to the extension
|
||||||
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);
|
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);
|
||||||
|
|
|
@ -11,8 +11,8 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- test changing the compression
|
-- test changing the compression
|
||||||
SELECT alter_cstore_table_set('table_options', compression => 'pglz');
|
SELECT alter_columnar_table_set('table_options', compression => 'pglz');
|
||||||
alter_cstore_table_set
|
alter_columnar_table_set
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -26,8 +26,8 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- test changing the block_row_count
|
-- test changing the block_row_count
|
||||||
SELECT alter_cstore_table_set('table_options', block_row_count => 10);
|
SELECT alter_columnar_table_set('table_options', block_row_count => 10);
|
||||||
alter_cstore_table_set
|
alter_columnar_table_set
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -41,8 +41,8 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- test changing the block_row_count
|
-- test changing the block_row_count
|
||||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
|
SELECT alter_columnar_table_set('table_options', stripe_row_count => 100);
|
||||||
alter_cstore_table_set
|
alter_columnar_table_set
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -66,8 +66,8 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- set all settings at the same time
|
-- set all settings at the same time
|
||||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
SELECT alter_columnar_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
||||||
alter_cstore_table_set
|
alter_columnar_table_set
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -93,8 +93,8 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
table_options | 100 | 1000 | none
|
table_options | 100 | 1000 | none
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', block_row_count => true);
|
SELECT alter_columnar_table_reset('table_options', block_row_count => true);
|
||||||
alter_cstore_table_reset
|
alter_columnar_table_reset
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -107,8 +107,8 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
table_options | 1000 | 1000 | none
|
table_options | 1000 | 1000 | none
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
|
SELECT alter_columnar_table_reset('table_options', stripe_row_count => true);
|
||||||
alter_cstore_table_reset
|
alter_columnar_table_reset
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -121,8 +121,8 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
table_options | 1000 | 10000 | none
|
table_options | 1000 | 10000 | none
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', compression => true);
|
SELECT alter_columnar_table_reset('table_options', compression => true);
|
||||||
alter_cstore_table_reset
|
alter_columnar_table_reset
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -147,12 +147,12 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
table_options | 1000 | 10000 | pglz
|
table_options | 1000 | 10000 | pglz
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset(
|
SELECT alter_columnar_table_reset(
|
||||||
'table_options',
|
'table_options',
|
||||||
block_row_count => true,
|
block_row_count => true,
|
||||||
stripe_row_count => true,
|
stripe_row_count => true,
|
||||||
compression => true);
|
compression => true);
|
||||||
alter_cstore_table_reset
|
alter_columnar_table_reset
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -168,12 +168,12 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
-- verify edge cases
|
-- verify edge cases
|
||||||
-- first start with a table that is not a cstore table
|
-- first start with a table that is not a cstore table
|
||||||
CREATE TABLE not_a_cstore_table (a int);
|
CREATE TABLE not_a_cstore_table (a int);
|
||||||
SELECT alter_cstore_table_set('not_a_cstore_table', compression => 'pglz');
|
SELECT alter_columnar_table_set('not_a_cstore_table', compression => 'pglz');
|
||||||
ERROR: table not_a_cstore_table is not a cstore table
|
ERROR: table not_a_cstore_table is not a cstore table
|
||||||
SELECT alter_cstore_table_reset('not_a_cstore_table', compression => true);
|
SELECT alter_columnar_table_reset('not_a_cstore_table', compression => true);
|
||||||
ERROR: table not_a_cstore_table is not a cstore table
|
ERROR: table not_a_cstore_table is not a cstore table
|
||||||
-- verify you can't use a compression that is not known
|
-- verify you can't use a compression that is not known
|
||||||
SELECT alter_cstore_table_set('table_options', compression => 'foobar');
|
SELECT alter_columnar_table_set('table_options', compression => 'foobar');
|
||||||
ERROR: unknown compression type for cstore table: foobar
|
ERROR: unknown compression type for cstore table: foobar
|
||||||
SET client_min_messages TO warning;
|
SET client_min_messages TO warning;
|
||||||
DROP SCHEMA am_tableoptions CASCADE;
|
DROP SCHEMA am_tableoptions CASCADE;
|
||||||
|
|
|
@ -36,8 +36,8 @@ SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.r
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- test the case when all data cannot fit into a single stripe
|
-- test the case when all data cannot fit into a single stripe
|
||||||
SELECT alter_cstore_table_set('t', stripe_row_count => 1000);
|
SELECT alter_columnar_table_set('t', stripe_row_count => 1000);
|
||||||
alter_cstore_table_set
|
alter_columnar_table_set
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -162,11 +162,11 @@ SELECT count(*) FROM t;
|
||||||
-- add some stripes with different compression types and create some gaps,
|
-- add some stripes with different compression types and create some gaps,
|
||||||
-- then vacuum to print stats
|
-- then vacuum to print stats
|
||||||
BEGIN;
|
BEGIN;
|
||||||
SELECT alter_cstore_table_set('t',
|
SELECT alter_columnar_table_set('t',
|
||||||
block_row_count => 1000,
|
block_row_count => 1000,
|
||||||
stripe_row_count => 2000,
|
stripe_row_count => 2000,
|
||||||
compression => 'pglz');
|
compression => 'pglz');
|
||||||
alter_cstore_table_set
|
alter_columnar_table_set
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -175,8 +175,8 @@ SAVEPOINT s1;
|
||||||
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
||||||
ROLLBACK TO SAVEPOINT s1;
|
ROLLBACK TO SAVEPOINT s1;
|
||||||
INSERT INTO t SELECT i / 5 FROM generate_series(1, 1500) i;
|
INSERT INTO t SELECT i / 5 FROM generate_series(1, 1500) i;
|
||||||
SELECT alter_cstore_table_set('t', compression => 'none');
|
SELECT alter_columnar_table_set('t', compression => 'none');
|
||||||
alter_cstore_table_set
|
alter_columnar_table_set
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -211,8 +211,8 @@ block count: 11, containing data for dropped columns: 2, none compressed: 9, pgl
|
||||||
-- vacuum full should remove blocks for dropped columns
|
-- vacuum full should remove blocks for dropped columns
|
||||||
-- note that, a block will be stored in non-compressed for if compression
|
-- note that, a block will be stored in non-compressed for if compression
|
||||||
-- doesn't reduce its size.
|
-- doesn't reduce its size.
|
||||||
SELECT alter_cstore_table_set('t', compression => 'pglz');
|
SELECT alter_columnar_table_set('t', compression => 'pglz');
|
||||||
alter_cstore_table_set
|
alter_columnar_table_set
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
|
@ -480,8 +480,8 @@ SELECT * FROM print_extension_changes();
|
||||||
| access method columnar
|
| access method columnar
|
||||||
| event trigger cstore_ddl_event_end
|
| event trigger cstore_ddl_event_end
|
||||||
| foreign-data wrapper cstore_fdw
|
| foreign-data wrapper cstore_fdw
|
||||||
| function alter_cstore_table_reset(regclass,boolean,boolean,boolean)
|
| function alter_columnar_table_reset(regclass,boolean,boolean,boolean)
|
||||||
| function alter_cstore_table_set(regclass,integer,integer,name)
|
| function alter_columnar_table_set(regclass,integer,integer,name)
|
||||||
| function citus_internal.cstore_ensure_objects_exist()
|
| function citus_internal.cstore_ensure_objects_exist()
|
||||||
| function cstore.cstore_ddl_event_end_trigger()
|
| function cstore.cstore_ddl_event_end_trigger()
|
||||||
| function cstore.cstore_fdw_handler()
|
| function cstore.cstore_fdw_handler()
|
||||||
|
|
|
@ -20,8 +20,8 @@ ORDER BY 1;
|
||||||
event trigger citus_cascade_to_partition
|
event trigger citus_cascade_to_partition
|
||||||
event trigger cstore_ddl_event_end
|
event trigger cstore_ddl_event_end
|
||||||
foreign-data wrapper cstore_fdw
|
foreign-data wrapper cstore_fdw
|
||||||
function alter_cstore_table_reset(regclass,boolean,boolean,boolean)
|
function alter_columnar_table_reset(regclass,boolean,boolean,boolean)
|
||||||
function alter_cstore_table_set(regclass,integer,integer,name)
|
function alter_columnar_table_set(regclass,integer,integer,name)
|
||||||
function alter_role_if_exists(text,text)
|
function alter_role_if_exists(text,text)
|
||||||
function any_value(anyelement)
|
function any_value(anyelement)
|
||||||
function any_value_agg(anyelement,anyelement)
|
function any_value_agg(anyelement,anyelement)
|
||||||
|
|
|
@ -9,21 +9,21 @@ SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- test changing the compression
|
-- test changing the compression
|
||||||
SELECT alter_cstore_table_set('table_options', compression => 'pglz');
|
SELECT alter_columnar_table_set('table_options', compression => 'pglz');
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- test changing the block_row_count
|
-- test changing the block_row_count
|
||||||
SELECT alter_cstore_table_set('table_options', block_row_count => 10);
|
SELECT alter_columnar_table_set('table_options', block_row_count => 10);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- test changing the block_row_count
|
-- test changing the block_row_count
|
||||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
|
SELECT alter_columnar_table_set('table_options', stripe_row_count => 100);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
|
@ -37,7 +37,7 @@ SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- set all settings at the same time
|
-- set all settings at the same time
|
||||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
SELECT alter_columnar_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
|
@ -53,18 +53,18 @@ SET cstore.compression TO 'pglz';
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', block_row_count => true);
|
SELECT alter_columnar_table_reset('table_options', block_row_count => true);
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
|
SELECT alter_columnar_table_reset('table_options', stripe_row_count => true);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', compression => true);
|
SELECT alter_columnar_table_reset('table_options', compression => true);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
|
@ -79,7 +79,7 @@ SET cstore.compression TO 'none';
|
||||||
SELECT * FROM cstore.columnar_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset(
|
SELECT alter_columnar_table_reset(
|
||||||
'table_options',
|
'table_options',
|
||||||
block_row_count => true,
|
block_row_count => true,
|
||||||
stripe_row_count => true,
|
stripe_row_count => true,
|
||||||
|
@ -92,11 +92,11 @@ WHERE regclass = 'table_options'::regclass;
|
||||||
-- verify edge cases
|
-- verify edge cases
|
||||||
-- first start with a table that is not a cstore table
|
-- first start with a table that is not a cstore table
|
||||||
CREATE TABLE not_a_cstore_table (a int);
|
CREATE TABLE not_a_cstore_table (a int);
|
||||||
SELECT alter_cstore_table_set('not_a_cstore_table', compression => 'pglz');
|
SELECT alter_columnar_table_set('not_a_cstore_table', compression => 'pglz');
|
||||||
SELECT alter_cstore_table_reset('not_a_cstore_table', compression => true);
|
SELECT alter_columnar_table_reset('not_a_cstore_table', compression => true);
|
||||||
|
|
||||||
-- verify you can't use a compression that is not known
|
-- verify you can't use a compression that is not known
|
||||||
SELECT alter_cstore_table_set('table_options', compression => 'foobar');
|
SELECT alter_columnar_table_set('table_options', compression => 'foobar');
|
||||||
|
|
||||||
SET client_min_messages TO warning;
|
SET client_min_messages TO warning;
|
||||||
DROP SCHEMA am_tableoptions CASCADE;
|
DROP SCHEMA am_tableoptions CASCADE;
|
||||||
|
|
|
@ -18,7 +18,7 @@ SELECT sum(a), sum(b) FROM t;
|
||||||
SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.relfilenode AND b.relname='t';
|
SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.relfilenode AND b.relname='t';
|
||||||
|
|
||||||
-- test the case when all data cannot fit into a single stripe
|
-- test the case when all data cannot fit into a single stripe
|
||||||
SELECT alter_cstore_table_set('t', stripe_row_count => 1000);
|
SELECT alter_columnar_table_set('t', stripe_row_count => 1000);
|
||||||
INSERT INTO t SELECT i, 2 * i FROM generate_series(1,2500) i;
|
INSERT INTO t SELECT i, 2 * i FROM generate_series(1,2500) i;
|
||||||
|
|
||||||
SELECT sum(a), sum(b) FROM t;
|
SELECT sum(a), sum(b) FROM t;
|
||||||
|
@ -65,7 +65,7 @@ SELECT count(*) FROM t;
|
||||||
-- then vacuum to print stats
|
-- then vacuum to print stats
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
SELECT alter_cstore_table_set('t',
|
SELECT alter_columnar_table_set('t',
|
||||||
block_row_count => 1000,
|
block_row_count => 1000,
|
||||||
stripe_row_count => 2000,
|
stripe_row_count => 2000,
|
||||||
compression => 'pglz');
|
compression => 'pglz');
|
||||||
|
@ -73,7 +73,7 @@ SAVEPOINT s1;
|
||||||
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
||||||
ROLLBACK TO SAVEPOINT s1;
|
ROLLBACK TO SAVEPOINT s1;
|
||||||
INSERT INTO t SELECT i / 5 FROM generate_series(1, 1500) i;
|
INSERT INTO t SELECT i / 5 FROM generate_series(1, 1500) i;
|
||||||
SELECT alter_cstore_table_set('t', compression => 'none');
|
SELECT alter_columnar_table_set('t', compression => 'none');
|
||||||
SAVEPOINT s2;
|
SAVEPOINT s2;
|
||||||
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
||||||
ROLLBACK TO SAVEPOINT s2;
|
ROLLBACK TO SAVEPOINT s2;
|
||||||
|
@ -94,7 +94,7 @@ VACUUM VERBOSE t;
|
||||||
-- vacuum full should remove blocks for dropped columns
|
-- vacuum full should remove blocks for dropped columns
|
||||||
-- note that, a block will be stored in non-compressed for if compression
|
-- note that, a block will be stored in non-compressed for if compression
|
||||||
-- doesn't reduce its size.
|
-- doesn't reduce its size.
|
||||||
SELECT alter_cstore_table_set('t', compression => 'pglz');
|
SELECT alter_columnar_table_set('t', compression => 'pglz');
|
||||||
VACUUM FULL t;
|
VACUUM FULL t;
|
||||||
VACUUM VERBOSE t;
|
VACUUM VERBOSE t;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue