Rename cstore->columnar in SQL objects and errors.

pull/4396/head
Jeff Davis 2020-12-07 13:00:43 -08:00
parent dee753ef05
commit 3758e83850
33 changed files with 344 additions and 345 deletions

View File

@ -41,7 +41,7 @@ static const struct config_enum_entry cstore_compression_options[] =
void void
cstore_init() cstore_init()
{ {
DefineCustomEnumVariable("cstore.compression", DefineCustomEnumVariable("columnar.compression",
"Compression type for cstore.", "Compression type for cstore.",
NULL, NULL,
&cstore_compression, &cstore_compression,
@ -53,7 +53,7 @@ cstore_init()
NULL, NULL,
NULL); NULL);
DefineCustomIntVariable("cstore.stripe_row_count", DefineCustomIntVariable("columnar.stripe_row_count",
"Maximum number of tuples per stripe.", "Maximum number of tuples per stripe.",
NULL, NULL,
&cstore_stripe_row_count, &cstore_stripe_row_count,
@ -66,7 +66,7 @@ cstore_init()
NULL, NULL,
NULL); NULL);
DefineCustomIntVariable("cstore.chunk_row_count", DefineCustomIntVariable("columnar.chunk_row_count",
"Maximum number of rows per chunk.", "Maximum number of rows per chunk.",
NULL, NULL,
&cstore_chunk_row_count, &cstore_chunk_row_count,

View File

@ -109,7 +109,7 @@ cstore_customscan_init()
/* register customscan specific GUC's */ /* register customscan specific GUC's */
DefineCustomBoolVariable( DefineCustomBoolVariable(
"cstore.enable_custom_scan", "columnar.enable_custom_scan",
gettext_noop("Enables the use of a custom scan to push projections and quals " gettext_noop("Enables the use of a custom scan to push projections and quals "
"into the storage layer"), "into the storage layer"),
NULL, NULL,

View File

@ -101,7 +101,7 @@ static bool WriteColumnarOptions(Oid regclass, ColumnarOptions *options, bool ov
PG_FUNCTION_INFO_V1(columnar_relation_storageid); PG_FUNCTION_INFO_V1(columnar_relation_storageid);
/* constants for cstore.options */ /* constants for columnar.options */
#define Natts_cstore_options 4 #define Natts_cstore_options 4
#define Anum_cstore_options_regclass 1 #define Anum_cstore_options_regclass 1
#define Anum_cstore_options_chunk_row_count 2 #define Anum_cstore_options_chunk_row_count 2
@ -109,7 +109,7 @@ PG_FUNCTION_INFO_V1(columnar_relation_storageid);
#define Anum_cstore_options_compression 4 #define Anum_cstore_options_compression 4
/* ---------------- /* ----------------
* cstore.options definition. * columnar.options definition.
* ---------------- * ----------------
*/ */
typedef struct FormData_cstore_options typedef struct FormData_cstore_options
@ -162,7 +162,7 @@ InitColumnarOptions(Oid regclass)
{ {
/* /*
* When upgrading we retain options for all columnar tables by upgrading * When upgrading we retain options for all columnar tables by upgrading
* "cstore.options" catalog table, so we shouldn't do anything here. * "columnar.options" catalog table, so we shouldn't do anything here.
*/ */
if (IsBinaryUpgrade) if (IsBinaryUpgrade)
{ {
@ -1041,7 +1041,7 @@ ByteaToDatum(bytea *bytes, Form_pg_attribute attrForm)
static Oid static Oid
CStoreStripesRelationId(void) CStoreStripesRelationId(void)
{ {
return get_relname_relid("cstore_stripes", CStoreNamespaceId()); return get_relname_relid("columnar_stripes", CStoreNamespaceId());
} }
@ -1052,12 +1052,12 @@ CStoreStripesRelationId(void)
static Oid static Oid
CStoreStripesIndexRelationId(void) CStoreStripesIndexRelationId(void)
{ {
return get_relname_relid("cstore_stripes_pkey", CStoreNamespaceId()); return get_relname_relid("columnar_stripes_pkey", CStoreNamespaceId());
} }
/* /*
* ColumnarOptionsRelationId returns relation id of cstore.options. * ColumnarOptionsRelationId returns relation id of columnar.options.
*/ */
static Oid static Oid
ColumnarOptionsRelationId(void) ColumnarOptionsRelationId(void)
@ -1067,7 +1067,7 @@ ColumnarOptionsRelationId(void)
/* /*
* ColumnarOptionsIndexRegclass returns relation id of cstore.options_pkey. * ColumnarOptionsIndexRegclass returns relation id of columnar.options_pkey.
*/ */
static Oid static Oid
ColumnarOptionsIndexRegclass(void) ColumnarOptionsIndexRegclass(void)
@ -1083,7 +1083,7 @@ ColumnarOptionsIndexRegclass(void)
static Oid static Oid
CStoreSkipNodesRelationId(void) CStoreSkipNodesRelationId(void)
{ {
return get_relname_relid("cstore_skipnodes", CStoreNamespaceId()); return get_relname_relid("columnar_skipnodes", CStoreNamespaceId());
} }
@ -1094,7 +1094,7 @@ CStoreSkipNodesRelationId(void)
static Oid static Oid
CStoreSkipNodesIndexRelationId(void) CStoreSkipNodesIndexRelationId(void)
{ {
return get_relname_relid("cstore_skipnodes_pkey", CStoreNamespaceId()); return get_relname_relid("columnar_skipnodes_pkey", CStoreNamespaceId());
} }
@ -1105,7 +1105,7 @@ CStoreSkipNodesIndexRelationId(void)
static Oid static Oid
CStoreNamespaceId(void) CStoreNamespaceId(void)
{ {
return get_namespace_oid("cstore", false); return get_namespace_oid("columnar", false);
} }

View File

@ -1462,7 +1462,7 @@ alter_columnar_table_set(PG_FUNCTION_ARGS)
Relation rel = table_open(relationId, AccessExclusiveLock); /* ALTER TABLE LOCK */ Relation rel = table_open(relationId, AccessExclusiveLock); /* ALTER TABLE LOCK */
if (!IsCStoreTableAmTable(relationId)) if (!IsCStoreTableAmTable(relationId))
{ {
ereport(ERROR, (errmsg("table %s is not a cstore table", ereport(ERROR, (errmsg("table %s is not a columnar table",
quote_identifier(RelationGetRelationName(rel))))); quote_identifier(RelationGetRelationName(rel)))));
} }
@ -1552,7 +1552,7 @@ alter_columnar_table_reset(PG_FUNCTION_ARGS)
Relation rel = table_open(relationId, AccessExclusiveLock); /* ALTER TABLE LOCK */ Relation rel = table_open(relationId, AccessExclusiveLock); /* ALTER TABLE LOCK */
if (!IsCStoreTableAmTable(relationId)) if (!IsCStoreTableAmTable(relationId))
{ {
ereport(ERROR, (errmsg("table %s is not a cstore table", ereport(ERROR, (errmsg("table %s is not a columnar table",
quote_identifier(RelationGetRelationName(rel))))); quote_identifier(RelationGetRelationName(rel)))));
} }

View File

@ -1,7 +1,7 @@
/* columnar--9.5-1--10.0-1.sql */ /* columnar--9.5-1--10.0-1.sql */
CREATE SCHEMA cstore; CREATE SCHEMA columnar;
SET search_path TO cstore; SET search_path TO columnar;
CREATE SEQUENCE storageid_seq MINVALUE 10000000000 NO CYCLE; CREATE SEQUENCE storageid_seq MINVALUE 10000000000 NO CYCLE;
@ -14,7 +14,7 @@ CREATE TABLE options (
COMMENT ON TABLE options IS 'columnar table specific options, maintained by alter_columnar_table_set'; COMMENT ON TABLE options IS 'columnar table specific options, maintained by alter_columnar_table_set';
CREATE TABLE cstore_stripes ( CREATE TABLE columnar_stripes (
storageid bigint NOT NULL, storageid bigint NOT NULL,
stripe bigint NOT NULL, stripe bigint NOT NULL,
file_offset bigint NOT NULL, file_offset bigint NOT NULL,
@ -26,9 +26,9 @@ CREATE TABLE cstore_stripes (
PRIMARY KEY (storageid, stripe) PRIMARY KEY (storageid, stripe)
) WITH (user_catalog_table = true); ) WITH (user_catalog_table = true);
COMMENT ON TABLE cstore_stripes IS 'CStore per stripe metadata'; COMMENT ON TABLE columnar_stripes IS 'Columnar per stripe metadata';
CREATE TABLE cstore_skipnodes ( CREATE TABLE columnar_skipnodes (
storageid bigint NOT NULL, storageid bigint NOT NULL,
stripe bigint NOT NULL, stripe bigint NOT NULL,
attr int NOT NULL, attr int NOT NULL,
@ -43,10 +43,10 @@ CREATE TABLE cstore_skipnodes (
value_compression_type int NOT NULL, value_compression_type int NOT NULL,
value_decompressed_length bigint NOT NULL, value_decompressed_length bigint NOT NULL,
PRIMARY KEY (storageid, stripe, attr, chunk), PRIMARY KEY (storageid, stripe, attr, chunk),
FOREIGN KEY (storageid, stripe) REFERENCES cstore_stripes(storageid, stripe) ON DELETE CASCADE FOREIGN KEY (storageid, stripe) REFERENCES columnar_stripes(storageid, stripe) ON DELETE CASCADE
) WITH (user_catalog_table = true); ) WITH (user_catalog_table = true);
COMMENT ON TABLE cstore_skipnodes IS 'CStore per chunk metadata'; COMMENT ON TABLE columnar_skipnodes IS 'Columnar per chunk metadata';
DO $proc$ DO $proc$
BEGIN BEGIN
@ -63,6 +63,6 @@ IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
END IF; END IF;
END$proc$; END$proc$;
#include "udfs/cstore_ensure_objects_exist/10.0-1.sql" #include "udfs/columnar_ensure_objects_exist/10.0-1.sql"
RESET search_path; RESET search_path;

View File

@ -1,4 +1,4 @@
-- citus_internal.cstore_ensure_objects_exist is an internal helper function to create -- citus_internal.columnar_ensure_objects_exist is an internal helper function to create
-- missing objects, anything related to the table access methods. -- missing objects, anything related to the table access methods.
-- Since the API for table access methods is only available in PG12 we can't create these -- Since the API for table access methods is only available in PG12 we can't create these
-- objects when Citus is installed in PG11. Once citus is installed on PG11 the user can -- objects when Citus is installed in PG11. Once citus is installed on PG11 the user can
@ -6,7 +6,7 @@
-- we couldn't create before. -- we couldn't create before.
-- This internal function is called from `citus_finish_pg_upgrade` which the user is -- This internal function is called from `citus_finish_pg_upgrade` which the user is
-- required to call after a PG major upgrade. -- required to call after a PG major upgrade.
CREATE OR REPLACE FUNCTION citus_internal.cstore_ensure_objects_exist() CREATE OR REPLACE FUNCTION citus_internal.columnar_ensure_objects_exist()
RETURNS void RETURNS void
LANGUAGE plpgsql LANGUAGE plpgsql
SET search_path = pg_catalog SET search_path = pg_catalog
@ -25,7 +25,7 @@ IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
#include "../alter_columnar_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 columnar.columnar_handler(internal);
ALTER EXTENSION citus ADD ACCESS METHOD columnar; ALTER EXTENSION citus ADD ACCESS METHOD columnar;
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_set( ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_set(
table_name regclass, table_name regclass,
@ -43,5 +43,5 @@ END IF;
END; END;
$ceoe$; $ceoe$;
COMMENT ON FUNCTION citus_internal.cstore_ensure_objects_exist() COMMENT ON FUNCTION citus_internal.columnar_ensure_objects_exist()
IS 'internal function to be called by pg_catalog.citus_finish_pg_upgrade responsible for creating the columnar objects'; IS 'internal function to be called by pg_catalog.citus_finish_pg_upgrade responsible for creating the columnar objects';

View File

@ -1,4 +1,4 @@
-- citus_internal.cstore_ensure_objects_exist is an internal helper function to create -- citus_internal.columnar_ensure_objects_exist is an internal helper function to create
-- missing objects, anything related to the table access methods. -- missing objects, anything related to the table access methods.
-- Since the API for table access methods is only available in PG12 we can't create these -- Since the API for table access methods is only available in PG12 we can't create these
-- objects when Citus is installed in PG11. Once citus is installed on PG11 the user can -- objects when Citus is installed in PG11. Once citus is installed on PG11 the user can
@ -6,7 +6,7 @@
-- we couldn't create before. -- we couldn't create before.
-- This internal function is called from `citus_finish_pg_upgrade` which the user is -- This internal function is called from `citus_finish_pg_upgrade` which the user is
-- required to call after a PG major upgrade. -- required to call after a PG major upgrade.
CREATE OR REPLACE FUNCTION citus_internal.cstore_ensure_objects_exist() CREATE OR REPLACE FUNCTION citus_internal.columnar_ensure_objects_exist()
RETURNS void RETURNS void
LANGUAGE plpgsql LANGUAGE plpgsql
SET search_path = pg_catalog SET search_path = pg_catalog
@ -25,7 +25,7 @@ IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
#include "../alter_columnar_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 columnar.columnar_handler(internal);
ALTER EXTENSION citus ADD ACCESS METHOD columnar; ALTER EXTENSION citus ADD ACCESS METHOD columnar;
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_set( ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_set(
table_name regclass, table_name regclass,
@ -43,5 +43,5 @@ END IF;
END; END;
$ceoe$; $ceoe$;
COMMENT ON FUNCTION citus_internal.cstore_ensure_objects_exist() COMMENT ON FUNCTION citus_internal.columnar_ensure_objects_exist()
IS 'internal function to be called by pg_catalog.citus_finish_pg_upgrade responsible for creating the columnar objects'; IS 'internal function to be called by pg_catalog.citus_finish_pg_upgrade responsible for creating the columnar objects';

View File

@ -1,9 +1,9 @@
CREATE OR REPLACE FUNCTION cstore.columnar_handler(internal) CREATE OR REPLACE FUNCTION columnar.columnar_handler(internal)
RETURNS table_am_handler RETURNS table_am_handler
LANGUAGE C LANGUAGE C
AS 'MODULE_PATHNAME', 'columnar_handler'; AS 'MODULE_PATHNAME', 'columnar_handler';
COMMENT ON FUNCTION cstore.columnar_handler(internal) COMMENT ON FUNCTION columnar.columnar_handler(internal)
IS 'internal function returning the handler for cstore tables'; IS 'internal function returning the handler for columnar tables';
CREATE ACCESS METHOD columnar TYPE TABLE HANDLER cstore.columnar_handler; CREATE ACCESS METHOD columnar TYPE TABLE HANDLER columnar.columnar_handler;

View File

@ -1,9 +1,9 @@
CREATE OR REPLACE FUNCTION cstore.columnar_handler(internal) CREATE OR REPLACE FUNCTION columnar.columnar_handler(internal)
RETURNS table_am_handler RETURNS table_am_handler
LANGUAGE C LANGUAGE C
AS 'MODULE_PATHNAME', 'columnar_handler'; AS 'MODULE_PATHNAME', 'columnar_handler';
COMMENT ON FUNCTION cstore.columnar_handler(internal) COMMENT ON FUNCTION columnar.columnar_handler(internal)
IS 'internal function returning the handler for cstore tables'; IS 'internal function returning the handler for columnar tables';
CREATE ACCESS METHOD columnar TYPE TABLE HANDLER cstore.columnar_handler; CREATE ACCESS METHOD columnar TYPE TABLE HANDLER columnar.columnar_handler;

View File

@ -45,7 +45,6 @@
#define CSTORE_VERSION_MINOR 7 #define CSTORE_VERSION_MINOR 7
/* miscellaneous defines */ /* miscellaneous defines */
#define CSTORE_FDW_NAME "cstore_fdw"
#define CSTORE_TUPLE_COST_MULTIPLIER 10 #define CSTORE_TUPLE_COST_MULTIPLIER 10
#define CSTORE_POSTSCRIPT_SIZE_LENGTH 1 #define CSTORE_POSTSCRIPT_SIZE_LENGTH 1
#define CSTORE_POSTSCRIPT_SIZE_MAX 256 #define CSTORE_POSTSCRIPT_SIZE_MAX 256
@ -63,7 +62,7 @@ typedef enum
/* /*
* CStoreFdwOptions holds the option values to be used when reading or writing * ColumnarOptions holds the option values to be used when reading or writing
* a cstore file. To resolve these values, we first check foreign table's options, * a cstore file. To resolve these values, we first check foreign table's options,
* and if not present, we then fall back to the default values specified above. * and if not present, we then fall back to the default values specified above.
*/ */

View File

@ -10,10 +10,10 @@
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#ifndef CSTORE_FDW_CSTORE_CUSTOMSCAN_H #ifndef COLUMNAR_CUSTOMSCAN_H
#define CSTORE_FDW_CSTORE_CUSTOMSCAN_H #define COLUMNAR_CUSTOMSCAN_H
void cstore_customscan_init(void); void cstore_customscan_init(void);
#endif /*CSTORE_FDW_CSTORE_CUSTOMSCAN_H */ #endif /* COLUMNAR_CUSTOMSCAN_H */

View File

@ -1,5 +1,5 @@
-- --
-- Tests the different DROP commands for cstore_fdw tables. -- Tests the different DROP commands for columnar tables.
-- --
-- DROP TABL -- DROP TABL
-- DROP SCHEMA -- DROP SCHEMA
@ -7,30 +7,30 @@
-- DROP DATABASE -- DROP DATABASE
-- --
-- Note that travis does not create -- Note that travis does not create
-- cstore_fdw extension in default database (postgres). This has caused -- columnar extension in default database (postgres). This has caused
-- different behavior between travis tests and local tests. Thus -- different behavior between travis tests and local tests. Thus
-- 'postgres' directory is excluded from comparison to have the same result. -- 'postgres' directory is excluded from comparison to have the same result.
-- store postgres database oid -- store postgres database oid
SELECT oid postgres_oid FROM pg_database WHERE datname = 'postgres' \gset SELECT oid postgres_oid FROM pg_database WHERE datname = 'postgres' \gset
SELECT count(distinct storageid) AS cstore_stripes_before_drop FROM cstore.cstore_stripes \gset SELECT count(distinct storageid) AS columnar_stripes_before_drop FROM columnar.columnar_stripes \gset
-- DROP cstore_fdw tables -- DROP columnar tables
DROP TABLE contestant; DROP TABLE contestant;
DROP TABLE contestant_compressed; DROP TABLE contestant_compressed;
-- make sure DROP deletes metadata -- make sure DROP deletes metadata
SELECT :cstore_stripes_before_drop - count(distinct storageid) FROM cstore.cstore_stripes; SELECT :columnar_stripes_before_drop - count(distinct storageid) FROM columnar.columnar_stripes;
?column? ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
2 2
(1 row) (1 row)
-- Create a cstore_fdw table under a schema and drop it. -- Create a columnar table under a schema and drop it.
CREATE SCHEMA test_schema; CREATE SCHEMA test_schema;
CREATE TABLE test_schema.test_table(data int) USING columnar; CREATE TABLE test_schema.test_table(data int) USING columnar;
INSERT INTO test_schema.test_table VALUES (1); INSERT INTO test_schema.test_table VALUES (1);
SELECT count(*) AS cstore_stripes_before_drop FROM cstore.cstore_stripes \gset SELECT count(*) AS columnar_stripes_before_drop FROM columnar.columnar_stripes \gset
DROP SCHEMA test_schema CASCADE; DROP SCHEMA test_schema CASCADE;
NOTICE: drop cascades to table test_schema.test_table NOTICE: drop cascades to table test_schema.test_table
SELECT :cstore_stripes_before_drop - count(distinct storageid) FROM cstore.cstore_stripes; SELECT :columnar_stripes_before_drop - count(distinct storageid) FROM columnar.columnar_stripes;
?column? ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
1 1

View File

@ -23,7 +23,7 @@ SELECT alter_columnar_table_set('t_compressed', chunk_row_count => 100);
(1 row) (1 row)
SELECT * FROM cstore.options WHERE regclass = 't_compressed'::regclass; SELECT * FROM columnar.options WHERE regclass = 't_compressed'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
t_compressed | 100 | 100 | pglz t_compressed | 100 | 100 | pglz

View File

@ -23,7 +23,7 @@ SELECT * FROM t_view a ORDER BY a;
(3 rows) (3 rows)
-- show columnar options for materialized view -- show columnar options for materialized view
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 't_view'::regclass; WHERE regclass = 't_view'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -37,7 +37,7 @@ SELECT alter_columnar_table_set('t_view', compression => 'pglz');
(1 row) (1 row)
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 't_view'::regclass; WHERE regclass = 't_view'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -46,7 +46,7 @@ WHERE regclass = 't_view'::regclass;
REFRESH MATERIALIZED VIEW t_view; REFRESH MATERIALIZED VIEW t_view;
-- verify options have not been changed -- verify options have not been changed
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 't_view'::regclass; WHERE regclass = 't_view'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -67,13 +67,13 @@ SELECT * FROM t_view a ORDER BY a;
-- verify that we have created metadata entries for the materialized view -- verify that we have created metadata entries for the materialized view
SELECT columnar_relation_storageid(oid) AS storageid SELECT columnar_relation_storageid(oid) AS storageid
FROM pg_class WHERE relname='t_view' \gset FROM pg_class WHERE relname='t_view' \gset
SELECT count(*) FROM cstore.cstore_stripes WHERE storageid=:storageid; SELECT count(*) FROM columnar.columnar_stripes WHERE storageid=:storageid;
count count
--------------------------------------------------------------------- ---------------------------------------------------------------------
1 1
(1 row) (1 row)
SELECT count(*) FROM cstore.cstore_skipnodes WHERE storageid=:storageid; SELECT count(*) FROM columnar.columnar_skipnodes WHERE storageid=:storageid;
count count
--------------------------------------------------------------------- ---------------------------------------------------------------------
3 3
@ -82,13 +82,13 @@ SELECT count(*) FROM cstore.cstore_skipnodes WHERE storageid=:storageid;
DROP TABLE t CASCADE; DROP TABLE t CASCADE;
NOTICE: drop cascades to materialized view t_view NOTICE: drop cascades to materialized view t_view
-- dropping must remove metadata -- dropping must remove metadata
SELECT count(*) FROM cstore.cstore_stripes WHERE storageid=:storageid; SELECT count(*) FROM columnar.columnar_stripes WHERE storageid=:storageid;
count count
--------------------------------------------------------------------- ---------------------------------------------------------------------
0 0
(1 row) (1 row)
SELECT count(*) FROM cstore.cstore_skipnodes WHERE storageid=:storageid; SELECT count(*) FROM columnar.columnar_skipnodes WHERE storageid=:storageid;
count count
--------------------------------------------------------------------- ---------------------------------------------------------------------
0 0

View File

@ -13,8 +13,8 @@ CREATE FUNCTION top_memory_context_usage()
RETURNS BIGINT AS $$ RETURNS BIGINT AS $$
SELECT TopMemoryContext FROM column_store_memory_stats(); SELECT TopMemoryContext FROM column_store_memory_stats();
$$ LANGUAGE SQL VOLATILE; $$ LANGUAGE SQL VOLATILE;
SET cstore.stripe_row_count TO 50000; SET columnar.stripe_row_count TO 50000;
SET cstore.compression TO 'pglz'; SET columnar.compression TO 'pglz';
CREATE TABLE t (a int, tag text, memusage bigint) USING columnar; CREATE TABLE t (a int, tag text, memusage bigint) USING columnar;
-- measure memory before doing writes -- measure memory before doing writes
SELECT TopMemoryContext as top_pre, SELECT TopMemoryContext as top_pre,

View File

@ -11,7 +11,7 @@ $$ LANGUAGE SQL;
INSERT INTO t2 SELECT i, f(i) FROM generate_series(1, 5) i; INSERT INTO t2 SELECT i, f(i) FROM generate_series(1, 5) i;
-- there are no subtransactions, so above statement should batch -- there are no subtransactions, so above statement should batch
-- INSERTs inside the UDF and create on stripe per table. -- INSERTs inside the UDF and create on stripe per table.
SELECT relname, count(*) FROM cstore.cstore_stripes a, pg_class b SELECT relname, count(*) FROM columnar.columnar_stripes a, pg_class b
WHERE columnar_relation_storageid(b.oid)=a.storageid AND relname IN ('t1', 't2') WHERE columnar_relation_storageid(b.oid)=a.storageid AND relname IN ('t1', 't2')
GROUP BY relname GROUP BY relname
ORDER BY relname; ORDER BY relname;

View File

@ -3,7 +3,7 @@
-- --
CREATE TABLE t(a int, b int) USING columnar; CREATE TABLE t(a int, b int) USING columnar;
CREATE VIEW t_stripes AS CREATE VIEW t_stripes AS
SELECT * FROM cstore.cstore_stripes a, pg_class b SELECT * FROM columnar.columnar_stripes a, pg_class b
WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname = 't'; WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname = 't';
BEGIN; BEGIN;
INSERT INTO t SELECT i, i+1 FROM generate_series(1, 10) i; INSERT INTO t SELECT i, i+1 FROM generate_series(1, 10) i;

View File

@ -3,7 +3,7 @@ SET search_path TO am_tableoptions;
CREATE TABLE table_options (a int) USING columnar; CREATE TABLE table_options (a int) USING columnar;
INSERT INTO table_options SELECT generate_series(1,100); INSERT INTO table_options SELECT generate_series(1,100);
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -18,7 +18,7 @@ SELECT alter_columnar_table_set('table_options', compression => 'pglz');
(1 row) (1 row)
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -33,7 +33,7 @@ SELECT alter_columnar_table_set('table_options', chunk_row_count => 10);
(1 row) (1 row)
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -48,7 +48,7 @@ SELECT alter_columnar_table_set('table_options', stripe_row_count => 100);
(1 row) (1 row)
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -58,7 +58,7 @@ WHERE regclass = 'table_options'::regclass;
-- VACUUM FULL creates a new table, make sure it copies settings from the table you are vacuuming -- VACUUM FULL creates a new table, make sure it copies settings from the table you are vacuuming
VACUUM FULL table_options; VACUUM FULL table_options;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -73,7 +73,7 @@ SELECT alter_columnar_table_set('table_options', stripe_row_count => 1000, chunk
(1 row) (1 row)
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -83,7 +83,7 @@ WHERE regclass = 'table_options'::regclass;
-- make sure table options are not changed when VACUUM a table -- make sure table options are not changed when VACUUM a table
VACUUM table_options; VACUUM table_options;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -93,7 +93,7 @@ WHERE regclass = 'table_options'::regclass;
-- make sure table options are not changed when VACUUM FULL a table -- make sure table options are not changed when VACUUM FULL a table
VACUUM FULL table_options; VACUUM FULL table_options;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -103,7 +103,7 @@ WHERE regclass = 'table_options'::regclass;
-- make sure table options are not changed when truncating a table -- make sure table options are not changed when truncating a table
TRUNCATE table_options; TRUNCATE table_options;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -112,7 +112,7 @@ WHERE regclass = 'table_options'::regclass;
ALTER TABLE table_options ALTER COLUMN a TYPE bigint; ALTER TABLE table_options ALTER COLUMN a TYPE bigint;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -120,12 +120,12 @@ WHERE regclass = 'table_options'::regclass;
(1 row) (1 row)
-- reset settings one by one to the version of the GUC's -- reset settings one by one to the version of the GUC's
SET cstore.chunk_row_count TO 1000; SET columnar.chunk_row_count TO 1000;
SET cstore.stripe_row_count TO 10000; SET columnar.stripe_row_count TO 10000;
SET cstore.compression TO 'pglz'; SET columnar.compression TO 'pglz';
-- verify setting the GUC's didn't change the settings -- verify setting the GUC's didn't change the settings
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -139,7 +139,7 @@ SELECT alter_columnar_table_reset('table_options', chunk_row_count => true);
(1 row) (1 row)
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -153,7 +153,7 @@ SELECT alter_columnar_table_reset('table_options', stripe_row_count => true);
(1 row) (1 row)
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -167,7 +167,7 @@ SELECT alter_columnar_table_reset('table_options', compression => true);
(1 row) (1 row)
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -175,11 +175,11 @@ WHERE regclass = 'table_options'::regclass;
(1 row) (1 row)
-- verify resetting all settings at once work -- verify resetting all settings at once work
SET cstore.chunk_row_count TO 10000; SET columnar.chunk_row_count TO 10000;
SET cstore.stripe_row_count TO 100000; SET columnar.stripe_row_count TO 100000;
SET cstore.compression TO 'none'; SET columnar.compression TO 'none';
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -197,7 +197,7 @@ SELECT alter_columnar_table_reset(
(1 row) (1 row)
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -205,19 +205,19 @@ WHERE regclass = 'table_options'::regclass;
(1 row) (1 row)
-- 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 columnar table
CREATE TABLE not_a_cstore_table (a int); CREATE TABLE not_a_columnar_table (a int);
SELECT alter_columnar_table_set('not_a_cstore_table', compression => 'pglz'); SELECT alter_columnar_table_set('not_a_columnar_table', compression => 'pglz');
ERROR: table not_a_cstore_table is not a cstore table ERROR: table not_a_columnar_table is not a columnar table
SELECT alter_columnar_table_reset('not_a_cstore_table', compression => true); SELECT alter_columnar_table_reset('not_a_columnar_table', compression => true);
ERROR: table not_a_cstore_table is not a cstore table ERROR: table not_a_columnar_table is not a columnar 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_columnar_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
-- verify options are removed when table is dropped -- verify options are removed when table is dropped
DROP TABLE table_options; DROP TABLE table_options;
-- we expect no entries in çstore.options for anything not found int pg_class -- we expect no entries in çstore.options for anything not found int pg_class
SELECT * FROM cstore.options o WHERE o.regclass NOT IN (SELECT oid FROM pg_class); SELECT * FROM columnar.options o WHERE o.regclass NOT IN (SELECT oid FROM pg_class);
regclass | chunk_row_count | stripe_row_count | compression regclass | chunk_row_count | stripe_row_count | compression
--------------------------------------------------------------------- ---------------------------------------------------------------------
(0 rows) (0 rows)

View File

@ -1,5 +1,5 @@
-- --
-- Test the TRUNCATE TABLE command for cstore_fdw tables. -- Test the TRUNCATE TABLE command for columnar tables.
-- --
-- print whether we're using version > 10 to make version-specific tests clear -- print whether we're using version > 10 to make version-specific tests clear
SHOW server_version \gset SHOW server_version \gset
@ -9,20 +9,20 @@ SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten;
t t
(1 row) (1 row)
-- CREATE a cstore_fdw table, fill with some data -- -- CREATE a columnar table, fill with some data --
CREATE TABLE cstore_truncate_test (a int, b int) USING columnar; CREATE TABLE columnar_truncate_test (a int, b int) USING columnar;
CREATE TABLE cstore_truncate_test_second (a int, b int) USING columnar; CREATE TABLE columnar_truncate_test_second (a int, b int) USING columnar;
-- COMPRESSED -- COMPRESSED
CREATE TABLE cstore_truncate_test_compressed (a int, b int) USING columnar; CREATE TABLE columnar_truncate_test_compressed (a int, b int) USING columnar;
CREATE TABLE cstore_truncate_test_regular (a int, b int); CREATE TABLE columnar_truncate_test_regular (a int, b int);
SELECT count(distinct storageid) AS cstore_data_files_before_truncate FROM cstore.cstore_stripes \gset SELECT count(distinct storageid) AS columnar_data_files_before_truncate FROM columnar.columnar_stripes \gset
INSERT INTO cstore_truncate_test select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test select a, a from generate_series(1, 10) a;
set cstore.compression = 'pglz'; set columnar.compression = 'pglz';
INSERT INTO cstore_truncate_test_compressed select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test_compressed select a, a from generate_series(1, 10) a;
INSERT INTO cstore_truncate_test_compressed select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test_compressed select a, a from generate_series(1, 10) a;
set cstore.compression to default; set columnar.compression to default;
-- query rows -- query rows
SELECT * FROM cstore_truncate_test; SELECT * FROM columnar_truncate_test;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
1 | 1 1 | 1
@ -37,41 +37,41 @@ SELECT * FROM cstore_truncate_test;
10 | 10 10 | 10
(10 rows) (10 rows)
TRUNCATE TABLE cstore_truncate_test; TRUNCATE TABLE columnar_truncate_test;
SELECT * FROM cstore_truncate_test; SELECT * FROM columnar_truncate_test;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
(0 rows) (0 rows)
SELECT COUNT(*) from cstore_truncate_test; SELECT COUNT(*) from columnar_truncate_test;
count count
--------------------------------------------------------------------- ---------------------------------------------------------------------
0 0
(1 row) (1 row)
SELECT count(*) FROM cstore_truncate_test_compressed; SELECT count(*) FROM columnar_truncate_test_compressed;
count count
--------------------------------------------------------------------- ---------------------------------------------------------------------
20 20
(1 row) (1 row)
TRUNCATE TABLE cstore_truncate_test_compressed; TRUNCATE TABLE columnar_truncate_test_compressed;
SELECT count(*) FROM cstore_truncate_test_compressed; SELECT count(*) FROM columnar_truncate_test_compressed;
count count
--------------------------------------------------------------------- ---------------------------------------------------------------------
0 0
(1 row) (1 row)
SELECT pg_relation_size('cstore_truncate_test_compressed'); SELECT pg_relation_size('columnar_truncate_test_compressed');
pg_relation_size pg_relation_size
--------------------------------------------------------------------- ---------------------------------------------------------------------
0 0
(1 row) (1 row)
INSERT INTO cstore_truncate_test select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test select a, a from generate_series(1, 10) a;
INSERT INTO cstore_truncate_test_regular select a, a from generate_series(10, 20) a; INSERT INTO columnar_truncate_test_regular select a, a from generate_series(10, 20) a;
INSERT INTO cstore_truncate_test_second select a, a from generate_series(20, 30) a; INSERT INTO columnar_truncate_test_second select a, a from generate_series(20, 30) a;
SELECT * from cstore_truncate_test; SELECT * from columnar_truncate_test;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
1 | 1 1 | 1
@ -86,7 +86,7 @@ SELECT * from cstore_truncate_test;
10 | 10 10 | 10
(10 rows) (10 rows)
SELECT * from cstore_truncate_test_second; SELECT * from columnar_truncate_test_second;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
20 | 20 20 | 20
@ -102,7 +102,7 @@ SELECT * from cstore_truncate_test_second;
30 | 30 30 | 30
(11 rows) (11 rows)
SELECT * from cstore_truncate_test_regular; SELECT * from columnar_truncate_test_regular;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
10 | 10 10 | 10
@ -120,34 +120,34 @@ SELECT * from cstore_truncate_test_regular;
-- make sure multi truncate works -- make sure multi truncate works
-- notice that the same table might be repeated -- notice that the same table might be repeated
TRUNCATE TABLE cstore_truncate_test, TRUNCATE TABLE columnar_truncate_test,
cstore_truncate_test_regular, columnar_truncate_test_regular,
cstore_truncate_test_second, columnar_truncate_test_second,
cstore_truncate_test; columnar_truncate_test;
SELECT * from cstore_truncate_test; SELECT * from columnar_truncate_test;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
(0 rows) (0 rows)
SELECT * from cstore_truncate_test_second; SELECT * from columnar_truncate_test_second;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
(0 rows) (0 rows)
SELECT * from cstore_truncate_test_regular; SELECT * from columnar_truncate_test_regular;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- test if truncate on empty table works -- test if truncate on empty table works
TRUNCATE TABLE cstore_truncate_test; TRUNCATE TABLE columnar_truncate_test;
SELECT * from cstore_truncate_test; SELECT * from columnar_truncate_test;
a | b a | b
--------------------------------------------------------------------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- make sure TRUNATE deletes metadata for old relfilenode -- make sure TRUNATE deletes metadata for old relfilenode
SELECT :cstore_data_files_before_truncate - count(distinct storageid) FROM cstore.cstore_stripes; SELECT :columnar_data_files_before_truncate - count(distinct storageid) FROM columnar.columnar_stripes;
?column? ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
0 0
@ -155,19 +155,19 @@ SELECT :cstore_data_files_before_truncate - count(distinct storageid) FROM cstor
-- test if truncation in the same transaction that created the table works properly -- test if truncation in the same transaction that created the table works properly
BEGIN; BEGIN;
CREATE TABLE cstore_same_transaction_truncate(a int) USING columnar; CREATE TABLE columnar_same_transaction_truncate(a int) USING columnar;
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(1, 100); INSERT INTO columnar_same_transaction_truncate SELECT * FROM generate_series(1, 100);
TRUNCATE cstore_same_transaction_truncate; TRUNCATE columnar_same_transaction_truncate;
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(20, 23); INSERT INTO columnar_same_transaction_truncate SELECT * FROM generate_series(20, 23);
COMMIT; COMMIT;
-- should output "1" for the newly created relation -- should output "1" for the newly created relation
SELECT count(distinct storageid) - :cstore_data_files_before_truncate FROM cstore.cstore_stripes; SELECT count(distinct storageid) - :columnar_data_files_before_truncate FROM columnar.columnar_stripes;
?column? ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
1 1
(1 row) (1 row)
SELECT * FROM cstore_same_transaction_truncate; SELECT * FROM columnar_same_transaction_truncate;
a a
--------------------------------------------------------------------- ---------------------------------------------------------------------
20 20
@ -176,38 +176,38 @@ SELECT * FROM cstore_same_transaction_truncate;
23 23
(4 rows) (4 rows)
DROP TABLE cstore_same_transaction_truncate; DROP TABLE columnar_same_transaction_truncate;
-- test if a cached truncate from a pl/pgsql function works -- test if a cached truncate from a pl/pgsql function works
CREATE FUNCTION cstore_truncate_test_regular_func() RETURNS void AS $$ CREATE FUNCTION columnar_truncate_test_regular_func() RETURNS void AS $$
BEGIN BEGIN
INSERT INTO cstore_truncate_test_regular select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test_regular select a, a from generate_series(1, 10) a;
TRUNCATE TABLE cstore_truncate_test_regular; TRUNCATE TABLE columnar_truncate_test_regular;
END;$$ END;$$
LANGUAGE plpgsql; LANGUAGE plpgsql;
SELECT cstore_truncate_test_regular_func(); SELECT columnar_truncate_test_regular_func();
cstore_truncate_test_regular_func columnar_truncate_test_regular_func
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
-- the cached plans are used stating from the second call -- the cached plans are used stating from the second call
SELECT cstore_truncate_test_regular_func(); SELECT columnar_truncate_test_regular_func();
cstore_truncate_test_regular_func columnar_truncate_test_regular_func
--------------------------------------------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
DROP FUNCTION cstore_truncate_test_regular_func(); DROP FUNCTION columnar_truncate_test_regular_func();
DROP TABLE cstore_truncate_test, cstore_truncate_test_second; DROP TABLE columnar_truncate_test, columnar_truncate_test_second;
DROP TABLE cstore_truncate_test_regular; DROP TABLE columnar_truncate_test_regular;
DROP TABLE cstore_truncate_test_compressed; DROP TABLE columnar_truncate_test_compressed;
-- test truncate with schema -- test truncate with schema
CREATE SCHEMA truncate_schema; CREATE SCHEMA truncate_schema;
-- COMPRESSED -- COMPRESSED
CREATE TABLE truncate_schema.truncate_tbl (id int) USING columnar; CREATE TABLE truncate_schema.truncate_tbl (id int) USING columnar;
set cstore.compression = 'pglz'; set columnar.compression = 'pglz';
INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100); INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100);
set cstore.compression to default; set columnar.compression to default;
SELECT COUNT(*) FROM truncate_schema.truncate_tbl; SELECT COUNT(*) FROM truncate_schema.truncate_tbl;
count count
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -221,9 +221,9 @@ SELECT COUNT(*) FROM truncate_schema.truncate_tbl;
0 0
(1 row) (1 row)
set cstore.compression = 'pglz'; set columnar.compression = 'pglz';
INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100); INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100);
set cstore.compression to default; set columnar.compression to default;
-- create a user that can not truncate -- create a user that can not truncate
CREATE USER truncate_user; CREATE USER truncate_user;
NOTICE: not propagating CREATE ROLE/USER commands to worker nodes NOTICE: not propagating CREATE ROLE/USER commands to worker nodes

View File

@ -1,7 +1,7 @@
SELECT count(distinct storageid) AS columnar_table_count FROM cstore.cstore_stripes \gset SELECT count(distinct storageid) AS columnar_table_count FROM columnar.columnar_stripes \gset
CREATE TABLE t(a int, b int) USING columnar; CREATE TABLE t(a int, b int) USING columnar;
CREATE VIEW t_stripes AS CREATE VIEW t_stripes AS
SELECT * FROM cstore.cstore_stripes a, pg_class b SELECT * FROM columnar.columnar_stripes a, pg_class b
WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t'; WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t';
SELECT count(*) FROM t_stripes; SELECT count(*) FROM t_stripes;
count count
@ -74,7 +74,7 @@ SELECT count(*) FROM t_stripes;
-- VACUUM FULL doesn't reclaim dropped columns, but converts them to NULLs -- VACUUM FULL doesn't reclaim dropped columns, but converts them to NULLs
ALTER TABLE t DROP COLUMN a; ALTER TABLE t DROP COLUMN a;
SELECT stripe, attr, chunk, minimum_value IS NULL, maximum_value IS NULL SELECT stripe, attr, chunk, minimum_value IS NULL, maximum_value IS NULL
FROM cstore.cstore_skipnodes a, pg_class b FROM columnar.columnar_skipnodes a, pg_class b
WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER BY 1, 2, 3; WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER BY 1, 2, 3;
stripe | attr | chunk | ?column? | ?column? stripe | attr | chunk | ?column? | ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -88,7 +88,7 @@ WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER B
VACUUM FULL t; VACUUM FULL t;
SELECT stripe, attr, chunk, minimum_value IS NULL, maximum_value IS NULL SELECT stripe, attr, chunk, minimum_value IS NULL, maximum_value IS NULL
FROM cstore.cstore_skipnodes a, pg_class b FROM columnar.columnar_skipnodes a, pg_class b
WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER BY 1, 2, 3; WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER BY 1, 2, 3;
stripe | attr | chunk | ?column? | ?column? stripe | attr | chunk | ?column? | ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -101,7 +101,7 @@ WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER B
(6 rows) (6 rows)
-- Make sure we cleaned-up the transient table metadata after VACUUM FULL commands -- Make sure we cleaned-up the transient table metadata after VACUUM FULL commands
SELECT count(distinct storageid) - :columnar_table_count FROM cstore.cstore_stripes; SELECT count(distinct storageid) - :columnar_table_count FROM columnar.columnar_stripes;
?column? ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
1 1
@ -241,16 +241,16 @@ chunk count: 8, containing data for dropped columns: 0, none compressed: 2, pglz
DROP TABLE t; DROP TABLE t;
DROP VIEW t_stripes; DROP VIEW t_stripes;
-- Make sure we cleaned the metadata for t too -- Make sure we cleaned the metadata for t too
SELECT count(distinct storageid) - :columnar_table_count FROM cstore.cstore_stripes; SELECT count(distinct storageid) - :columnar_table_count FROM columnar.columnar_stripes;
?column? ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
0 0
(1 row) (1 row)
-- A table with high compression ratio -- A table with high compression ratio
SET cstore.compression TO 'pglz'; SET columnar.compression TO 'pglz';
SET cstore.stripe_row_count TO 1000000; SET columnar.stripe_row_count TO 1000000;
SET cstore.chunk_row_count TO 100000; SET columnar.chunk_row_count TO 100000;
CREATE TABLE t(a int, b char, c text) USING columnar; CREATE TABLE t(a int, b char, c text) USING columnar;
INSERT INTO t SELECT 1, 'a', 'xyz' FROM generate_series(1, 1000000) i; INSERT INTO t SELECT 1, 'a', 'xyz' FROM generate_series(1, 1000000) i;
VACUUM VERBOSE t; VACUUM VERBOSE t;

View File

@ -15,7 +15,7 @@ SELECT create_distributed_table('table_option', 'a');
-- setting: compression -- setting: compression
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -34,7 +34,7 @@ SELECT alter_columnar_table_set('table_option', compression => 'pglz');
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -53,7 +53,7 @@ SELECT alter_columnar_table_reset('table_option', compression => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -66,7 +66,7 @@ $cmd$);
-- setting: chunk_row_count -- setting: chunk_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -85,7 +85,7 @@ SELECT alter_columnar_table_set('table_option', chunk_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -104,7 +104,7 @@ SELECT alter_columnar_table_reset('table_option', chunk_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -117,7 +117,7 @@ $cmd$);
-- setting: stripe_row_count -- setting: stripe_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -136,7 +136,7 @@ SELECT alter_columnar_table_set('table_option', stripe_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -155,7 +155,7 @@ SELECT alter_columnar_table_reset('table_option', stripe_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -184,7 +184,7 @@ SELECT create_distributed_table('table_option_2', 'a');
-- verify settings on placements -- verify settings on placements
SELECT run_command_on_placements('table_option_2',$cmd$ SELECT run_command_on_placements('table_option_2',$cmd$
SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM cstore.options WHERE regclass = '%s'::regclass; SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -208,7 +208,7 @@ SELECT create_distributed_table('table_option', 'a');
-- setting: compression -- setting: compression
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -231,7 +231,7 @@ SELECT alter_columnar_table_set('table_option', compression => 'pglz');
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -254,7 +254,7 @@ SELECT alter_columnar_table_reset('table_option', compression => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -271,7 +271,7 @@ $cmd$);
-- setting: chunk_row_count -- setting: chunk_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -294,7 +294,7 @@ SELECT alter_columnar_table_set('table_option', chunk_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -317,7 +317,7 @@ SELECT alter_columnar_table_reset('table_option', chunk_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -334,7 +334,7 @@ $cmd$);
-- setting: stripe_row_count -- setting: stripe_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -357,7 +357,7 @@ SELECT alter_columnar_table_set('table_option', stripe_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -380,7 +380,7 @@ SELECT alter_columnar_table_reset('table_option', stripe_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -413,7 +413,7 @@ SELECT create_distributed_table('table_option_2', 'a');
-- verify settings on placements -- verify settings on placements
SELECT run_command_on_placements('table_option_2',$cmd$ SELECT run_command_on_placements('table_option_2',$cmd$
SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM cstore.options WHERE regclass = '%s'::regclass; SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -439,7 +439,7 @@ SELECT create_reference_table('table_option_reference');
-- setting: compression -- setting: compression
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -456,7 +456,7 @@ SELECT alter_columnar_table_set('table_option_reference', compression => 'pglz')
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -473,7 +473,7 @@ SELECT alter_columnar_table_reset('table_option_reference', compression => true)
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -484,7 +484,7 @@ $cmd$);
-- setting: chunk_row_count -- setting: chunk_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -501,7 +501,7 @@ SELECT alter_columnar_table_set('table_option_reference', chunk_row_count => 100
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -518,7 +518,7 @@ SELECT alter_columnar_table_reset('table_option_reference', chunk_row_count => t
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -529,7 +529,7 @@ $cmd$);
-- setting: stripe_row_count -- setting: stripe_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -546,7 +546,7 @@ SELECT alter_columnar_table_set('table_option_reference', stripe_row_count => 10
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -563,7 +563,7 @@ SELECT alter_columnar_table_reset('table_option_reference', stripe_row_count =>
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -590,7 +590,7 @@ SELECT create_reference_table('table_option_reference_2');
-- verify settings on placements -- verify settings on placements
SELECT run_command_on_placements('table_option_reference_2',$cmd$ SELECT run_command_on_placements('table_option_reference_2',$cmd$
SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM cstore.options WHERE regclass = '%s'::regclass; SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
run_command_on_placements run_command_on_placements
--------------------------------------------------------------------- ---------------------------------------------------------------------

View File

@ -1,11 +1,11 @@
-- --
-- Test chunk filtering in cstore_fdw using min/max values in stripe skip lists. -- Test chunk filtering in columnar using min/max values in stripe skip lists.
-- --
-- --
-- filtered_row_count returns number of rows filtered by the WHERE clause. -- filtered_row_count returns number of rows filtered by the WHERE clause.
-- If chunks get filtered by cstore_fdw, less rows are passed to WHERE -- If chunks get filtered by columnar, less rows are passed to WHERE
-- clause, so this function should return a lower number. -- clause, so this function should return a lower number.
-- --
CREATE OR REPLACE FUNCTION filtered_row_count (query text) RETURNS bigint AS CREATE OR REPLACE FUNCTION filtered_row_count (query text) RETURNS bigint AS
@ -29,8 +29,8 @@ $$ LANGUAGE PLPGSQL;
-- Create and load data -- Create and load data
-- chunk_row_count '1000', stripe_row_count '2000' -- chunk_row_count '1000', stripe_row_count '2000'
set cstore.stripe_row_count = 2000; set columnar.stripe_row_count = 2000;
set cstore.chunk_row_count = 1000; set columnar.chunk_row_count = 1000;
CREATE TABLE test_chunk_filtering (a int) CREATE TABLE test_chunk_filtering (a int)
USING columnar; USING columnar;
@ -58,8 +58,8 @@ SELECT filtered_row_count('SELECT count(*) FROM test_chunk_filtering WHERE a < 2
SELECT filtered_row_count('SELECT count(*) FROM test_chunk_filtering WHERE a < 0'); SELECT filtered_row_count('SELECT count(*) FROM test_chunk_filtering WHERE a < 0');
SELECT filtered_row_count('SELECT count(*) FROM test_chunk_filtering WHERE a BETWEEN 990 AND 2010'); SELECT filtered_row_count('SELECT count(*) FROM test_chunk_filtering WHERE a BETWEEN 990 AND 2010');
set cstore.stripe_row_count to default; set columnar.stripe_row_count to default;
set cstore.chunk_row_count to default; set columnar.chunk_row_count to default;
-- Verify that we are fine with collations which use a different alphabet order -- Verify that we are fine with collations which use a different alphabet order
CREATE TABLE collation_chunk_filtering_test(A text collate "da_DK") CREATE TABLE collation_chunk_filtering_test(A text collate "da_DK")

View File

@ -1,9 +1,9 @@
-- --
-- Test chunk filtering in cstore_fdw using min/max values in stripe skip lists. -- Test chunk filtering in columnar using min/max values in stripe skip lists.
-- --
-- --
-- filtered_row_count returns number of rows filtered by the WHERE clause. -- filtered_row_count returns number of rows filtered by the WHERE clause.
-- If chunks get filtered by cstore_fdw, less rows are passed to WHERE -- If chunks get filtered by columnar, less rows are passed to WHERE
-- clause, so this function should return a lower number. -- clause, so this function should return a lower number.
-- --
CREATE OR REPLACE FUNCTION filtered_row_count (query text) RETURNS bigint AS CREATE OR REPLACE FUNCTION filtered_row_count (query text) RETURNS bigint AS
@ -25,8 +25,8 @@ $$
$$ LANGUAGE PLPGSQL; $$ LANGUAGE PLPGSQL;
-- Create and load data -- Create and load data
-- chunk_row_count '1000', stripe_row_count '2000' -- chunk_row_count '1000', stripe_row_count '2000'
set cstore.stripe_row_count = 2000; set columnar.stripe_row_count = 2000;
set cstore.chunk_row_count = 1000; set columnar.chunk_row_count = 1000;
CREATE TABLE test_chunk_filtering (a int) CREATE TABLE test_chunk_filtering (a int)
USING columnar; USING columnar;
COPY test_chunk_filtering FROM '@abs_srcdir@/data/chunk_filtering.csv' WITH CSV; COPY test_chunk_filtering FROM '@abs_srcdir@/data/chunk_filtering.csv' WITH CSV;
@ -106,8 +106,8 @@ SELECT filtered_row_count('SELECT count(*) FROM test_chunk_filtering WHERE a BET
3958 3958
(1 row) (1 row)
set cstore.stripe_row_count to default; set columnar.stripe_row_count to default;
set cstore.chunk_row_count to default; set columnar.chunk_row_count to default;
-- Verify that we are fine with collations which use a different alphabet order -- Verify that we are fine with collations which use a different alphabet order
CREATE TABLE collation_chunk_filtering_test(A text collate "da_DK") CREATE TABLE collation_chunk_filtering_test(A text collate "da_DK")
USING columnar; USING columnar;

View File

@ -1,5 +1,5 @@
-- --
-- Tests the different DROP commands for cstore_fdw tables. -- Tests the different DROP commands for columnar tables.
-- --
-- DROP TABL -- DROP TABL
-- DROP SCHEMA -- DROP SCHEMA
@ -8,30 +8,30 @@
-- --
-- Note that travis does not create -- Note that travis does not create
-- cstore_fdw extension in default database (postgres). This has caused -- columnar extension in default database (postgres). This has caused
-- different behavior between travis tests and local tests. Thus -- different behavior between travis tests and local tests. Thus
-- 'postgres' directory is excluded from comparison to have the same result. -- 'postgres' directory is excluded from comparison to have the same result.
-- store postgres database oid -- store postgres database oid
SELECT oid postgres_oid FROM pg_database WHERE datname = 'postgres' \gset SELECT oid postgres_oid FROM pg_database WHERE datname = 'postgres' \gset
SELECT count(distinct storageid) AS cstore_stripes_before_drop FROM cstore.cstore_stripes \gset SELECT count(distinct storageid) AS columnar_stripes_before_drop FROM columnar.columnar_stripes \gset
-- DROP cstore_fdw tables -- DROP columnar tables
DROP TABLE contestant; DROP TABLE contestant;
DROP TABLE contestant_compressed; DROP TABLE contestant_compressed;
-- make sure DROP deletes metadata -- make sure DROP deletes metadata
SELECT :cstore_stripes_before_drop - count(distinct storageid) FROM cstore.cstore_stripes; SELECT :columnar_stripes_before_drop - count(distinct storageid) FROM columnar.columnar_stripes;
-- Create a cstore_fdw table under a schema and drop it. -- Create a columnar table under a schema and drop it.
CREATE SCHEMA test_schema; CREATE SCHEMA test_schema;
CREATE TABLE test_schema.test_table(data int) USING columnar; CREATE TABLE test_schema.test_table(data int) USING columnar;
INSERT INTO test_schema.test_table VALUES (1); INSERT INTO test_schema.test_table VALUES (1);
SELECT count(*) AS cstore_stripes_before_drop FROM cstore.cstore_stripes \gset SELECT count(*) AS columnar_stripes_before_drop FROM columnar.columnar_stripes \gset
DROP SCHEMA test_schema CASCADE; DROP SCHEMA test_schema CASCADE;
SELECT :cstore_stripes_before_drop - count(distinct storageid) FROM cstore.cstore_stripes; SELECT :columnar_stripes_before_drop - count(distinct storageid) FROM columnar.columnar_stripes;
SELECT current_database() datname \gset SELECT current_database() datname \gset

View File

@ -11,7 +11,7 @@ SELECT alter_columnar_table_set('t_compressed', compression => 'pglz');
SELECT alter_columnar_table_set('t_compressed', stripe_row_count => 100); SELECT alter_columnar_table_set('t_compressed', stripe_row_count => 100);
SELECT alter_columnar_table_set('t_compressed', chunk_row_count => 100); SELECT alter_columnar_table_set('t_compressed', chunk_row_count => 100);
SELECT * FROM cstore.options WHERE regclass = 't_compressed'::regclass; SELECT * FROM columnar.options WHERE regclass = 't_compressed'::regclass;
-- select -- select
select * from t_uncompressed; select * from t_uncompressed;

View File

@ -16,18 +16,18 @@ INSERT INTO t SELECT floor(i / 4), 2 * i FROM generate_series(11, 20) i;
SELECT * FROM t_view a ORDER BY a; SELECT * FROM t_view a ORDER BY a;
-- show columnar options for materialized view -- show columnar options for materialized view
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 't_view'::regclass; WHERE regclass = 't_view'::regclass;
-- show we can set options on a materialized view -- show we can set options on a materialized view
SELECT alter_columnar_table_set('t_view', compression => 'pglz'); SELECT alter_columnar_table_set('t_view', compression => 'pglz');
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 't_view'::regclass; WHERE regclass = 't_view'::regclass;
REFRESH MATERIALIZED VIEW t_view; REFRESH MATERIALIZED VIEW t_view;
-- verify options have not been changed -- verify options have not been changed
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 't_view'::regclass; WHERE regclass = 't_view'::regclass;
SELECT * FROM t_view a ORDER BY a; SELECT * FROM t_view a ORDER BY a;
@ -36,11 +36,11 @@ SELECT * FROM t_view a ORDER BY a;
SELECT columnar_relation_storageid(oid) AS storageid SELECT columnar_relation_storageid(oid) AS storageid
FROM pg_class WHERE relname='t_view' \gset FROM pg_class WHERE relname='t_view' \gset
SELECT count(*) FROM cstore.cstore_stripes WHERE storageid=:storageid; SELECT count(*) FROM columnar.columnar_stripes WHERE storageid=:storageid;
SELECT count(*) FROM cstore.cstore_skipnodes WHERE storageid=:storageid; SELECT count(*) FROM columnar.columnar_skipnodes WHERE storageid=:storageid;
DROP TABLE t CASCADE; DROP TABLE t CASCADE;
-- dropping must remove metadata -- dropping must remove metadata
SELECT count(*) FROM cstore.cstore_stripes WHERE storageid=:storageid; SELECT count(*) FROM columnar.columnar_stripes WHERE storageid=:storageid;
SELECT count(*) FROM cstore.cstore_skipnodes WHERE storageid=:storageid; SELECT count(*) FROM columnar.columnar_skipnodes WHERE storageid=:storageid;

View File

@ -17,8 +17,8 @@ CREATE FUNCTION top_memory_context_usage()
SELECT TopMemoryContext FROM column_store_memory_stats(); SELECT TopMemoryContext FROM column_store_memory_stats();
$$ LANGUAGE SQL VOLATILE; $$ LANGUAGE SQL VOLATILE;
SET cstore.stripe_row_count TO 50000; SET columnar.stripe_row_count TO 50000;
SET cstore.compression TO 'pglz'; SET columnar.compression TO 'pglz';
CREATE TABLE t (a int, tag text, memusage bigint) USING columnar; CREATE TABLE t (a int, tag text, memusage bigint) USING columnar;
-- measure memory before doing writes -- measure memory before doing writes

View File

@ -15,7 +15,7 @@ INSERT INTO t2 SELECT i, f(i) FROM generate_series(1, 5) i;
-- there are no subtransactions, so above statement should batch -- there are no subtransactions, so above statement should batch
-- INSERTs inside the UDF and create on stripe per table. -- INSERTs inside the UDF and create on stripe per table.
SELECT relname, count(*) FROM cstore.cstore_stripes a, pg_class b SELECT relname, count(*) FROM columnar.columnar_stripes a, pg_class b
WHERE columnar_relation_storageid(b.oid)=a.storageid AND relname IN ('t1', 't2') WHERE columnar_relation_storageid(b.oid)=a.storageid AND relname IN ('t1', 't2')
GROUP BY relname GROUP BY relname
ORDER BY relname; ORDER BY relname;

View File

@ -5,7 +5,7 @@
CREATE TABLE t(a int, b int) USING columnar; CREATE TABLE t(a int, b int) USING columnar;
CREATE VIEW t_stripes AS CREATE VIEW t_stripes AS
SELECT * FROM cstore.cstore_stripes a, pg_class b SELECT * FROM columnar.columnar_stripes a, pg_class b
WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname = 't'; WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname = 't';
BEGIN; BEGIN;

View File

@ -5,101 +5,101 @@ CREATE TABLE table_options (a int) USING columnar;
INSERT INTO table_options SELECT generate_series(1,100); INSERT INTO table_options SELECT generate_series(1,100);
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- test changing the compression -- test changing the compression
SELECT alter_columnar_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.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- test changing the chunk_row_count -- test changing the chunk_row_count
SELECT alter_columnar_table_set('table_options', chunk_row_count => 10); SELECT alter_columnar_table_set('table_options', chunk_row_count => 10);
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- test changing the chunk_row_count -- test changing the chunk_row_count
SELECT alter_columnar_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.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- VACUUM FULL creates a new table, make sure it copies settings from the table you are vacuuming -- VACUUM FULL creates a new table, make sure it copies settings from the table you are vacuuming
VACUUM FULL table_options; VACUUM FULL table_options;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM 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_columnar_table_set('table_options', stripe_row_count => 1000, chunk_row_count => 100, compression => 'none'); SELECT alter_columnar_table_set('table_options', stripe_row_count => 1000, chunk_row_count => 100, compression => 'none');
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- make sure table options are not changed when VACUUM a table -- make sure table options are not changed when VACUUM a table
VACUUM table_options; VACUUM table_options;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- make sure table options are not changed when VACUUM FULL a table -- make sure table options are not changed when VACUUM FULL a table
VACUUM FULL table_options; VACUUM FULL table_options;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- make sure table options are not changed when truncating a table -- make sure table options are not changed when truncating a table
TRUNCATE table_options; TRUNCATE table_options;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
ALTER TABLE table_options ALTER COLUMN a TYPE bigint; ALTER TABLE table_options ALTER COLUMN a TYPE bigint;
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- reset settings one by one to the version of the GUC's -- reset settings one by one to the version of the GUC's
SET cstore.chunk_row_count TO 1000; SET columnar.chunk_row_count TO 1000;
SET cstore.stripe_row_count TO 10000; SET columnar.stripe_row_count TO 10000;
SET cstore.compression TO 'pglz'; SET columnar.compression TO 'pglz';
-- verify setting the GUC's didn't change the settings -- verify setting the GUC's didn't change the settings
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
SELECT alter_columnar_table_reset('table_options', chunk_row_count => true); SELECT alter_columnar_table_reset('table_options', chunk_row_count => true);
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
SELECT alter_columnar_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.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
SELECT alter_columnar_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.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
-- verify resetting all settings at once work -- verify resetting all settings at once work
SET cstore.chunk_row_count TO 10000; SET columnar.chunk_row_count TO 10000;
SET cstore.stripe_row_count TO 100000; SET columnar.stripe_row_count TO 100000;
SET cstore.compression TO 'none'; SET columnar.compression TO 'none';
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; WHERE regclass = 'table_options'::regclass;
SELECT alter_columnar_table_reset( SELECT alter_columnar_table_reset(
@ -109,14 +109,14 @@ SELECT alter_columnar_table_reset(
compression => true); compression => true);
-- show table_options settings -- show table_options settings
SELECT * FROM cstore.options SELECT * FROM columnar.options
WHERE regclass = 'table_options'::regclass; 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 columnar table
CREATE TABLE not_a_cstore_table (a int); CREATE TABLE not_a_columnar_table (a int);
SELECT alter_columnar_table_set('not_a_cstore_table', compression => 'pglz'); SELECT alter_columnar_table_set('not_a_columnar_table', compression => 'pglz');
SELECT alter_columnar_table_reset('not_a_cstore_table', compression => true); SELECT alter_columnar_table_reset('not_a_columnar_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_columnar_table_set('table_options', compression => 'foobar'); SELECT alter_columnar_table_set('table_options', compression => 'foobar');
@ -124,7 +124,7 @@ SELECT alter_columnar_table_set('table_options', compression => 'foobar');
-- verify options are removed when table is dropped -- verify options are removed when table is dropped
DROP TABLE table_options; DROP TABLE table_options;
-- we expect no entries in çstore.options for anything not found int pg_class -- we expect no entries in çstore.options for anything not found int pg_class
SELECT * FROM cstore.options o WHERE o.regclass NOT IN (SELECT oid FROM pg_class); SELECT * FROM columnar.options o WHERE o.regclass NOT IN (SELECT oid FROM pg_class);
SET client_min_messages TO warning; SET client_min_messages TO warning;
DROP SCHEMA am_tableoptions CASCADE; DROP SCHEMA am_tableoptions CASCADE;

View File

@ -1,116 +1,116 @@
-- --
-- Test the TRUNCATE TABLE command for cstore_fdw tables. -- Test the TRUNCATE TABLE command for columnar tables.
-- --
-- print whether we're using version > 10 to make version-specific tests clear -- print whether we're using version > 10 to make version-specific tests clear
SHOW server_version \gset SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten; SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten;
-- CREATE a cstore_fdw table, fill with some data -- -- CREATE a columnar table, fill with some data --
CREATE TABLE cstore_truncate_test (a int, b int) USING columnar; CREATE TABLE columnar_truncate_test (a int, b int) USING columnar;
CREATE TABLE cstore_truncate_test_second (a int, b int) USING columnar; CREATE TABLE columnar_truncate_test_second (a int, b int) USING columnar;
-- COMPRESSED -- COMPRESSED
CREATE TABLE cstore_truncate_test_compressed (a int, b int) USING columnar; CREATE TABLE columnar_truncate_test_compressed (a int, b int) USING columnar;
CREATE TABLE cstore_truncate_test_regular (a int, b int); CREATE TABLE columnar_truncate_test_regular (a int, b int);
SELECT count(distinct storageid) AS cstore_data_files_before_truncate FROM cstore.cstore_stripes \gset SELECT count(distinct storageid) AS columnar_data_files_before_truncate FROM columnar.columnar_stripes \gset
INSERT INTO cstore_truncate_test select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test select a, a from generate_series(1, 10) a;
set cstore.compression = 'pglz'; set columnar.compression = 'pglz';
INSERT INTO cstore_truncate_test_compressed select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test_compressed select a, a from generate_series(1, 10) a;
INSERT INTO cstore_truncate_test_compressed select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test_compressed select a, a from generate_series(1, 10) a;
set cstore.compression to default; set columnar.compression to default;
-- query rows -- query rows
SELECT * FROM cstore_truncate_test; SELECT * FROM columnar_truncate_test;
TRUNCATE TABLE cstore_truncate_test; TRUNCATE TABLE columnar_truncate_test;
SELECT * FROM cstore_truncate_test; SELECT * FROM columnar_truncate_test;
SELECT COUNT(*) from cstore_truncate_test; SELECT COUNT(*) from columnar_truncate_test;
SELECT count(*) FROM cstore_truncate_test_compressed; SELECT count(*) FROM columnar_truncate_test_compressed;
TRUNCATE TABLE cstore_truncate_test_compressed; TRUNCATE TABLE columnar_truncate_test_compressed;
SELECT count(*) FROM cstore_truncate_test_compressed; SELECT count(*) FROM columnar_truncate_test_compressed;
SELECT pg_relation_size('cstore_truncate_test_compressed'); SELECT pg_relation_size('columnar_truncate_test_compressed');
INSERT INTO cstore_truncate_test select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test select a, a from generate_series(1, 10) a;
INSERT INTO cstore_truncate_test_regular select a, a from generate_series(10, 20) a; INSERT INTO columnar_truncate_test_regular select a, a from generate_series(10, 20) a;
INSERT INTO cstore_truncate_test_second select a, a from generate_series(20, 30) a; INSERT INTO columnar_truncate_test_second select a, a from generate_series(20, 30) a;
SELECT * from cstore_truncate_test; SELECT * from columnar_truncate_test;
SELECT * from cstore_truncate_test_second; SELECT * from columnar_truncate_test_second;
SELECT * from cstore_truncate_test_regular; SELECT * from columnar_truncate_test_regular;
-- make sure multi truncate works -- make sure multi truncate works
-- notice that the same table might be repeated -- notice that the same table might be repeated
TRUNCATE TABLE cstore_truncate_test, TRUNCATE TABLE columnar_truncate_test,
cstore_truncate_test_regular, columnar_truncate_test_regular,
cstore_truncate_test_second, columnar_truncate_test_second,
cstore_truncate_test; columnar_truncate_test;
SELECT * from cstore_truncate_test; SELECT * from columnar_truncate_test;
SELECT * from cstore_truncate_test_second; SELECT * from columnar_truncate_test_second;
SELECT * from cstore_truncate_test_regular; SELECT * from columnar_truncate_test_regular;
-- test if truncate on empty table works -- test if truncate on empty table works
TRUNCATE TABLE cstore_truncate_test; TRUNCATE TABLE columnar_truncate_test;
SELECT * from cstore_truncate_test; SELECT * from columnar_truncate_test;
-- make sure TRUNATE deletes metadata for old relfilenode -- make sure TRUNATE deletes metadata for old relfilenode
SELECT :cstore_data_files_before_truncate - count(distinct storageid) FROM cstore.cstore_stripes; SELECT :columnar_data_files_before_truncate - count(distinct storageid) FROM columnar.columnar_stripes;
-- test if truncation in the same transaction that created the table works properly -- test if truncation in the same transaction that created the table works properly
BEGIN; BEGIN;
CREATE TABLE cstore_same_transaction_truncate(a int) USING columnar; CREATE TABLE columnar_same_transaction_truncate(a int) USING columnar;
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(1, 100); INSERT INTO columnar_same_transaction_truncate SELECT * FROM generate_series(1, 100);
TRUNCATE cstore_same_transaction_truncate; TRUNCATE columnar_same_transaction_truncate;
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(20, 23); INSERT INTO columnar_same_transaction_truncate SELECT * FROM generate_series(20, 23);
COMMIT; COMMIT;
-- should output "1" for the newly created relation -- should output "1" for the newly created relation
SELECT count(distinct storageid) - :cstore_data_files_before_truncate FROM cstore.cstore_stripes; SELECT count(distinct storageid) - :columnar_data_files_before_truncate FROM columnar.columnar_stripes;
SELECT * FROM cstore_same_transaction_truncate; SELECT * FROM columnar_same_transaction_truncate;
DROP TABLE cstore_same_transaction_truncate; DROP TABLE columnar_same_transaction_truncate;
-- test if a cached truncate from a pl/pgsql function works -- test if a cached truncate from a pl/pgsql function works
CREATE FUNCTION cstore_truncate_test_regular_func() RETURNS void AS $$ CREATE FUNCTION columnar_truncate_test_regular_func() RETURNS void AS $$
BEGIN BEGIN
INSERT INTO cstore_truncate_test_regular select a, a from generate_series(1, 10) a; INSERT INTO columnar_truncate_test_regular select a, a from generate_series(1, 10) a;
TRUNCATE TABLE cstore_truncate_test_regular; TRUNCATE TABLE columnar_truncate_test_regular;
END;$$ END;$$
LANGUAGE plpgsql; LANGUAGE plpgsql;
SELECT cstore_truncate_test_regular_func(); SELECT columnar_truncate_test_regular_func();
-- the cached plans are used stating from the second call -- the cached plans are used stating from the second call
SELECT cstore_truncate_test_regular_func(); SELECT columnar_truncate_test_regular_func();
DROP FUNCTION cstore_truncate_test_regular_func(); DROP FUNCTION columnar_truncate_test_regular_func();
DROP TABLE cstore_truncate_test, cstore_truncate_test_second; DROP TABLE columnar_truncate_test, columnar_truncate_test_second;
DROP TABLE cstore_truncate_test_regular; DROP TABLE columnar_truncate_test_regular;
DROP TABLE cstore_truncate_test_compressed; DROP TABLE columnar_truncate_test_compressed;
-- test truncate with schema -- test truncate with schema
CREATE SCHEMA truncate_schema; CREATE SCHEMA truncate_schema;
-- COMPRESSED -- COMPRESSED
CREATE TABLE truncate_schema.truncate_tbl (id int) USING columnar; CREATE TABLE truncate_schema.truncate_tbl (id int) USING columnar;
set cstore.compression = 'pglz'; set columnar.compression = 'pglz';
INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100); INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100);
set cstore.compression to default; set columnar.compression to default;
SELECT COUNT(*) FROM truncate_schema.truncate_tbl; SELECT COUNT(*) FROM truncate_schema.truncate_tbl;
TRUNCATE TABLE truncate_schema.truncate_tbl; TRUNCATE TABLE truncate_schema.truncate_tbl;
SELECT COUNT(*) FROM truncate_schema.truncate_tbl; SELECT COUNT(*) FROM truncate_schema.truncate_tbl;
set cstore.compression = 'pglz'; set columnar.compression = 'pglz';
INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100); INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100);
set cstore.compression to default; set columnar.compression to default;
-- create a user that can not truncate -- create a user that can not truncate
CREATE USER truncate_user; CREATE USER truncate_user;
GRANT USAGE ON SCHEMA truncate_schema TO truncate_user; GRANT USAGE ON SCHEMA truncate_schema TO truncate_user;

View File

@ -1,9 +1,9 @@
SELECT count(distinct storageid) AS columnar_table_count FROM cstore.cstore_stripes \gset SELECT count(distinct storageid) AS columnar_table_count FROM columnar.columnar_stripes \gset
CREATE TABLE t(a int, b int) USING columnar; CREATE TABLE t(a int, b int) USING columnar;
CREATE VIEW t_stripes AS CREATE VIEW t_stripes AS
SELECT * FROM cstore.cstore_stripes a, pg_class b SELECT * FROM columnar.columnar_stripes a, pg_class b
WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t'; WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t';
SELECT count(*) FROM t_stripes; SELECT count(*) FROM t_stripes;
@ -37,17 +37,17 @@ SELECT count(*) FROM t_stripes;
ALTER TABLE t DROP COLUMN a; ALTER TABLE t DROP COLUMN a;
SELECT stripe, attr, chunk, minimum_value IS NULL, maximum_value IS NULL SELECT stripe, attr, chunk, minimum_value IS NULL, maximum_value IS NULL
FROM cstore.cstore_skipnodes a, pg_class b FROM columnar.columnar_skipnodes a, pg_class b
WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER BY 1, 2, 3; WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER BY 1, 2, 3;
VACUUM FULL t; VACUUM FULL t;
SELECT stripe, attr, chunk, minimum_value IS NULL, maximum_value IS NULL SELECT stripe, attr, chunk, minimum_value IS NULL, maximum_value IS NULL
FROM cstore.cstore_skipnodes a, pg_class b FROM columnar.columnar_skipnodes a, pg_class b
WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER BY 1, 2, 3; WHERE a.storageid = columnar_relation_storageid(b.oid) AND b.relname='t' ORDER BY 1, 2, 3;
-- Make sure we cleaned-up the transient table metadata after VACUUM FULL commands -- Make sure we cleaned-up the transient table metadata after VACUUM FULL commands
SELECT count(distinct storageid) - :columnar_table_count FROM cstore.cstore_stripes; SELECT count(distinct storageid) - :columnar_table_count FROM columnar.columnar_stripes;
-- do this in a transaction so concurrent autovacuum doesn't interfere with results -- do this in a transaction so concurrent autovacuum doesn't interfere with results
BEGIN; BEGIN;
@ -110,12 +110,12 @@ DROP TABLE t;
DROP VIEW t_stripes; DROP VIEW t_stripes;
-- Make sure we cleaned the metadata for t too -- Make sure we cleaned the metadata for t too
SELECT count(distinct storageid) - :columnar_table_count FROM cstore.cstore_stripes; SELECT count(distinct storageid) - :columnar_table_count FROM columnar.columnar_stripes;
-- A table with high compression ratio -- A table with high compression ratio
SET cstore.compression TO 'pglz'; SET columnar.compression TO 'pglz';
SET cstore.stripe_row_count TO 1000000; SET columnar.stripe_row_count TO 1000000;
SET cstore.chunk_row_count TO 100000; SET columnar.chunk_row_count TO 100000;
CREATE TABLE t(a int, b char, c text) USING columnar; CREATE TABLE t(a int, b char, c text) USING columnar;
INSERT INTO t SELECT 1, 'a', 'xyz' FROM generate_series(1, 1000000) i; INSERT INTO t SELECT 1, 'a', 'xyz' FROM generate_series(1, 1000000) i;

View File

@ -13,55 +13,55 @@ SELECT create_distributed_table('table_option', 'a');
-- setting: compression -- setting: compression
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option', compression => 'pglz'); SELECT alter_columnar_table_set('table_option', compression => 'pglz');
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option', compression => true); SELECT alter_columnar_table_reset('table_option', compression => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- setting: chunk_row_count -- setting: chunk_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option', chunk_row_count => 100); SELECT alter_columnar_table_set('table_option', chunk_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option', chunk_row_count => true); SELECT alter_columnar_table_reset('table_option', chunk_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- setting: stripe_row_count -- setting: stripe_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option', stripe_row_count => 100); SELECT alter_columnar_table_set('table_option', stripe_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option', stripe_row_count => true); SELECT alter_columnar_table_reset('table_option', stripe_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- verify settings are propagated when creating a table -- verify settings are propagated when creating a table
@ -74,7 +74,7 @@ SELECT create_distributed_table('table_option_2', 'a');
-- verify settings on placements -- verify settings on placements
SELECT run_command_on_placements('table_option_2',$cmd$ SELECT run_command_on_placements('table_option_2',$cmd$
SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM cstore.options WHERE regclass = '%s'::regclass; SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
DROP TABLE table_option, table_option_2; DROP TABLE table_option, table_option_2;
@ -89,55 +89,55 @@ SELECT create_distributed_table('table_option', 'a');
-- setting: compression -- setting: compression
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option', compression => 'pglz'); SELECT alter_columnar_table_set('table_option', compression => 'pglz');
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option', compression => true); SELECT alter_columnar_table_reset('table_option', compression => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- setting: chunk_row_count -- setting: chunk_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option', chunk_row_count => 100); SELECT alter_columnar_table_set('table_option', chunk_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option', chunk_row_count => true); SELECT alter_columnar_table_reset('table_option', chunk_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- setting: stripe_row_count -- setting: stripe_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option', stripe_row_count => 100); SELECT alter_columnar_table_set('table_option', stripe_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option', stripe_row_count => true); SELECT alter_columnar_table_reset('table_option', stripe_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option',$cmd$ SELECT run_command_on_placements('table_option',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- verify settings are propagated when creating a table -- verify settings are propagated when creating a table
@ -150,7 +150,7 @@ SELECT create_distributed_table('table_option_2', 'a');
-- verify settings on placements -- verify settings on placements
SELECT run_command_on_placements('table_option_2',$cmd$ SELECT run_command_on_placements('table_option_2',$cmd$
SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM cstore.options WHERE regclass = '%s'::regclass; SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
DROP TABLE table_option, table_option_2; DROP TABLE table_option, table_option_2;
@ -162,55 +162,55 @@ SELECT create_reference_table('table_option_reference');
-- setting: compression -- setting: compression
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option_reference', compression => 'pglz'); SELECT alter_columnar_table_set('table_option_reference', compression => 'pglz');
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option_reference', compression => true); SELECT alter_columnar_table_reset('table_option_reference', compression => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT compression FROM cstore.options WHERE regclass = '%s'::regclass; SELECT compression FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- setting: chunk_row_count -- setting: chunk_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option_reference', chunk_row_count => 100); SELECT alter_columnar_table_set('table_option_reference', chunk_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option_reference', chunk_row_count => true); SELECT alter_columnar_table_reset('table_option_reference', chunk_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT chunk_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT chunk_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- setting: stripe_row_count -- setting: stripe_row_count
-- get baseline for setting -- get baseline for setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- change setting -- change setting
SELECT alter_columnar_table_set('table_option_reference', stripe_row_count => 100); SELECT alter_columnar_table_set('table_option_reference', stripe_row_count => 100);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- reset setting -- reset setting
SELECT alter_columnar_table_reset('table_option_reference', stripe_row_count => true); SELECT alter_columnar_table_reset('table_option_reference', stripe_row_count => true);
-- verify setting -- verify setting
SELECT run_command_on_placements('table_option_reference',$cmd$ SELECT run_command_on_placements('table_option_reference',$cmd$
SELECT stripe_row_count FROM cstore.options WHERE regclass = '%s'::regclass; SELECT stripe_row_count FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
-- verify settings are propagated when creating a table -- verify settings are propagated when creating a table
@ -223,7 +223,7 @@ SELECT create_reference_table('table_option_reference_2');
-- verify settings on placements -- verify settings on placements
SELECT run_command_on_placements('table_option_reference_2',$cmd$ SELECT run_command_on_placements('table_option_reference_2',$cmd$
SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM cstore.options WHERE regclass = '%s'::regclass; SELECT ROW(chunk_row_count, stripe_row_count, compression) FROM columnar.options WHERE regclass = '%s'::regclass;
$cmd$); $cmd$);
DROP TABLE table_option_reference, table_option_reference_2; DROP TABLE table_option_reference, table_option_reference_2;