mirror of https://github.com/citusdata/citus.git
commit
4e035b6044
|
@ -160,7 +160,7 @@ CStoreSetRelPathlistHook(PlannerInfo *root, RelOptInfo *rel, Index rti,
|
|||
* into the scan of the table to minimize the data read.
|
||||
*/
|
||||
Relation relation = RelationIdGetRelation(rte->relid);
|
||||
if (relation->rd_tableam == GetCstoreTableAmRoutine())
|
||||
if (relation->rd_tableam == GetColumnarTableAmRoutine())
|
||||
{
|
||||
Path *customPath = CreateCStoreScanPath(rel, rte);
|
||||
|
||||
|
|
|
@ -1080,7 +1080,7 @@ CStoreTableAMProcessUtility(PlannedStmt * plannedStatement,
|
|||
CreateTrigStmt *createTrigStmt = (CreateTrigStmt *) parseTree;
|
||||
|
||||
Relation rel = relation_openrv(createTrigStmt->relation, AccessShareLock);
|
||||
bool isCStore = rel->rd_tableam == GetCstoreTableAmRoutine();
|
||||
bool isCStore = rel->rd_tableam == GetColumnarTableAmRoutine();
|
||||
relation_close(rel, AccessShareLock);
|
||||
|
||||
if (isCStore &&
|
||||
|
@ -1187,7 +1187,7 @@ IsCStoreTableAmTable(Oid relationId)
|
|||
* avoid race conditions.
|
||||
*/
|
||||
Relation rel = relation_open(relationId, AccessShareLock);
|
||||
bool result = rel->rd_tableam == GetCstoreTableAmRoutine();
|
||||
bool result = rel->rd_tableam == GetColumnarTableAmRoutine();
|
||||
relation_close(rel, NoLock);
|
||||
|
||||
return result;
|
||||
|
@ -1251,26 +1251,26 @@ static const TableAmRoutine cstore_am_methods = {
|
|||
|
||||
|
||||
const TableAmRoutine *
|
||||
GetCstoreTableAmRoutine(void)
|
||||
GetColumnarTableAmRoutine(void)
|
||||
{
|
||||
return &cstore_am_methods;
|
||||
}
|
||||
|
||||
|
||||
PG_FUNCTION_INFO_V1(cstore_tableam_handler);
|
||||
PG_FUNCTION_INFO_V1(columnar_handler);
|
||||
Datum
|
||||
cstore_tableam_handler(PG_FUNCTION_ARGS)
|
||||
columnar_handler(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_POINTER(&cstore_am_methods);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* alter_cstore_table_set is a UDF exposed in postgres to change settings on a columnar
|
||||
* alter_columnar_table_set is a UDF exposed in postgres to change settings on a columnar
|
||||
* table. Calling this function on a non-columnar table gives an error.
|
||||
*
|
||||
* sql syntax:
|
||||
* pg_catalog.alter_cstore_table_set(
|
||||
* pg_catalog.alter_columnar_table_set(
|
||||
* table_name regclass,
|
||||
* block_row_count int DEFAULT NULL,
|
||||
* stripe_row_count int DEFAULT NULL,
|
||||
|
@ -1278,16 +1278,16 @@ cstore_tableam_handler(PG_FUNCTION_ARGS)
|
|||
*
|
||||
* All arguments except the table name are optional. The UDF is supposed to be called
|
||||
* like:
|
||||
* SELECT alter_cstore_table_set('table', compression => 'pglz');
|
||||
* SELECT alter_columnar_table_set('table', compression => 'pglz');
|
||||
*
|
||||
* This will only update the compression of the table, keeping all other settings the
|
||||
* same. Multiple settings can be changed at the same time by providing multiple
|
||||
* arguments. Calling the argument with the NULL value will be interperted as not having
|
||||
* provided the argument.
|
||||
*/
|
||||
PG_FUNCTION_INFO_V1(alter_cstore_table_set);
|
||||
PG_FUNCTION_INFO_V1(alter_columnar_table_set);
|
||||
Datum
|
||||
alter_cstore_table_set(PG_FUNCTION_ARGS)
|
||||
alter_columnar_table_set(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid relationId = PG_GETARG_OID(0);
|
||||
|
||||
|
@ -1340,9 +1340,9 @@ alter_cstore_table_set(PG_FUNCTION_ARGS)
|
|||
}
|
||||
|
||||
|
||||
PG_FUNCTION_INFO_V1(alter_cstore_table_reset);
|
||||
PG_FUNCTION_INFO_V1(alter_columnar_table_reset);
|
||||
Datum
|
||||
alter_cstore_table_reset(PG_FUNCTION_ARGS)
|
||||
alter_columnar_table_reset(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid relationId = PG_GETARG_OID(0);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ CREATE TABLE cstore_skipnodes (
|
|||
|
||||
COMMENT ON TABLE cstore_skipnodes IS 'CStore per block metadata';
|
||||
|
||||
CREATE VIEW cstore_options AS
|
||||
CREATE VIEW columnar_options AS
|
||||
SELECT c.oid::regclass regclass,
|
||||
d.block_row_count,
|
||||
d.stripe_row_count,
|
||||
|
@ -85,7 +85,7 @@ SELECT c.oid::regclass regclass,
|
|||
FROM pg_class c
|
||||
JOIN cstore.cstore_data_files d USING(relfilenode);
|
||||
|
||||
COMMENT ON VIEW cstore_options IS 'CStore per table settings';
|
||||
COMMENT ON VIEW columnar_options IS 'CStore per table settings';
|
||||
|
||||
DO $proc$
|
||||
BEGIN
|
||||
|
@ -95,9 +95,9 @@ BEGIN
|
|||
-- user instead to add the missing objects
|
||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
||||
EXECUTE $$
|
||||
#include "udfs/cstore_tableam_handler/10.0-1.sql"
|
||||
#include "udfs/alter_cstore_table_set/10.0-1.sql"
|
||||
#include "udfs/alter_cstore_table_reset/10.0-1.sql"
|
||||
#include "udfs/columnar_handler/10.0-1.sql"
|
||||
#include "udfs/alter_columnar_table_set/10.0-1.sql"
|
||||
#include "udfs/alter_columnar_table_reset/10.0-1.sql"
|
||||
$$;
|
||||
END IF;
|
||||
END$proc$;
|
||||
|
|
|
@ -7,27 +7,27 @@ BEGIN
|
|||
|
||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
||||
EXECUTE $$
|
||||
DROP FUNCTION pg_catalog.alter_cstore_table_reset(
|
||||
DROP FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||
table_name regclass,
|
||||
block_row_count bool,
|
||||
stripe_row_count bool,
|
||||
compression bool);
|
||||
|
||||
DROP FUNCTION pg_catalog.alter_cstore_table_set(
|
||||
DROP FUNCTION pg_catalog.alter_columnar_table_set(
|
||||
table_name regclass,
|
||||
block_row_count int,
|
||||
stripe_row_count int,
|
||||
compression name);
|
||||
|
||||
DROP ACCESS METHOD cstore_tableam;
|
||||
DROP ACCESS METHOD columnar;
|
||||
|
||||
DROP FUNCTION cstore_tableam_handler(internal);
|
||||
DROP FUNCTION columnar_handler(internal);
|
||||
|
||||
$$;
|
||||
END IF;
|
||||
END$proc$;
|
||||
|
||||
DROP VIEW cstore_options;
|
||||
DROP VIEW columnar_options;
|
||||
DROP TABLE cstore_skipnodes;
|
||||
DROP TABLE cstore_stripes;
|
||||
DROP TABLE cstore_data_files;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_reset(
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||
table_name regclass,
|
||||
block_row_count bool DEFAULT false,
|
||||
stripe_row_count bool DEFAULT false,
|
||||
compression bool DEFAULT false)
|
||||
RETURNS void
|
||||
LANGUAGE C
|
||||
AS 'MODULE_PATHNAME', 'alter_cstore_table_reset';
|
||||
AS 'MODULE_PATHNAME', 'alter_columnar_table_reset';
|
||||
|
||||
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_reset(
|
||||
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||
table_name regclass,
|
||||
block_row_count bool,
|
||||
stripe_row_count bool,
|
|
@ -1,13 +1,13 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_reset(
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||
table_name regclass,
|
||||
block_row_count bool DEFAULT false,
|
||||
stripe_row_count bool DEFAULT false,
|
||||
compression bool DEFAULT false)
|
||||
RETURNS void
|
||||
LANGUAGE C
|
||||
AS 'MODULE_PATHNAME', 'alter_cstore_table_reset';
|
||||
AS 'MODULE_PATHNAME', 'alter_columnar_table_reset';
|
||||
|
||||
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_reset(
|
||||
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||
table_name regclass,
|
||||
block_row_count bool,
|
||||
stripe_row_count bool,
|
|
@ -1,13 +1,13 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_set(
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_set(
|
||||
table_name regclass,
|
||||
block_row_count int DEFAULT NULL,
|
||||
stripe_row_count int DEFAULT NULL,
|
||||
compression name DEFAULT null)
|
||||
RETURNS void
|
||||
LANGUAGE C
|
||||
AS 'MODULE_PATHNAME', 'alter_cstore_table_set';
|
||||
AS 'MODULE_PATHNAME', 'alter_columnar_table_set';
|
||||
|
||||
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_set(
|
||||
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_set(
|
||||
table_name regclass,
|
||||
block_row_count int,
|
||||
stripe_row_count int,
|
|
@ -1,13 +1,13 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_set(
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_set(
|
||||
table_name regclass,
|
||||
block_row_count int DEFAULT NULL,
|
||||
stripe_row_count int DEFAULT NULL,
|
||||
compression name DEFAULT null)
|
||||
RETURNS void
|
||||
LANGUAGE C
|
||||
AS 'MODULE_PATHNAME', 'alter_cstore_table_set';
|
||||
AS 'MODULE_PATHNAME', 'alter_columnar_table_set';
|
||||
|
||||
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_set(
|
||||
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_set(
|
||||
table_name regclass,
|
||||
block_row_count int,
|
||||
stripe_row_count int,
|
|
@ -0,0 +1,9 @@
|
|||
CREATE OR REPLACE FUNCTION cstore.columnar_handler(internal)
|
||||
RETURNS table_am_handler
|
||||
LANGUAGE C
|
||||
AS 'MODULE_PATHNAME', 'columnar_handler';
|
||||
|
||||
COMMENT ON FUNCTION cstore.columnar_handler(internal)
|
||||
IS 'internal function returning the handler for cstore tables';
|
||||
|
||||
CREATE ACCESS METHOD columnar TYPE TABLE HANDLER cstore.columnar_handler;
|
|
@ -0,0 +1,9 @@
|
|||
CREATE OR REPLACE FUNCTION cstore.columnar_handler(internal)
|
||||
RETURNS table_am_handler
|
||||
LANGUAGE C
|
||||
AS 'MODULE_PATHNAME', 'columnar_handler';
|
||||
|
||||
COMMENT ON FUNCTION cstore.columnar_handler(internal)
|
||||
IS 'internal function returning the handler for cstore tables';
|
||||
|
||||
CREATE ACCESS METHOD columnar TYPE TABLE HANDLER cstore.columnar_handler;
|
|
@ -16,23 +16,23 @@ BEGIN
|
|||
-- when postgres is version 12 or above we need to create the tableam. If the tableam
|
||||
-- exist we assume all objects have been created.
|
||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'cstore_tableam') THEN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
|
||||
|
||||
#include "../cstore_tableam_handler/10.0-1.sql"
|
||||
#include "../columnar_handler/10.0-1.sql"
|
||||
|
||||
#include "../alter_cstore_table_set/10.0-1.sql"
|
||||
#include "../alter_columnar_table_set/10.0-1.sql"
|
||||
|
||||
#include "../alter_cstore_table_reset/10.0-1.sql"
|
||||
#include "../alter_columnar_table_reset/10.0-1.sql"
|
||||
|
||||
-- add the missing objects to the extension
|
||||
ALTER EXTENSION citus ADD FUNCTION cstore.cstore_tableam_handler(internal);
|
||||
ALTER EXTENSION citus ADD ACCESS METHOD cstore_tableam;
|
||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_cstore_table_set(
|
||||
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);
|
||||
ALTER EXTENSION citus ADD ACCESS METHOD columnar;
|
||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_set(
|
||||
table_name regclass,
|
||||
block_row_count int,
|
||||
stripe_row_count int,
|
||||
compression name);
|
||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_cstore_table_reset(
|
||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||
table_name regclass,
|
||||
block_row_count bool,
|
||||
stripe_row_count bool,
|
||||
|
|
|
@ -16,23 +16,23 @@ BEGIN
|
|||
-- when postgres is version 12 or above we need to create the tableam. If the tableam
|
||||
-- exist we assume all objects have been created.
|
||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'cstore_tableam') THEN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
|
||||
|
||||
#include "../cstore_tableam_handler/10.0-1.sql"
|
||||
#include "../columnar_handler/10.0-1.sql"
|
||||
|
||||
#include "../alter_cstore_table_set/10.0-1.sql"
|
||||
#include "../alter_columnar_table_set/10.0-1.sql"
|
||||
|
||||
#include "../alter_cstore_table_reset/10.0-1.sql"
|
||||
#include "../alter_columnar_table_reset/10.0-1.sql"
|
||||
|
||||
-- add the missing objects to the extension
|
||||
ALTER EXTENSION citus ADD FUNCTION cstore.cstore_tableam_handler(internal);
|
||||
ALTER EXTENSION citus ADD ACCESS METHOD cstore_tableam;
|
||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_cstore_table_set(
|
||||
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);
|
||||
ALTER EXTENSION citus ADD ACCESS METHOD columnar;
|
||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_set(
|
||||
table_name regclass,
|
||||
block_row_count int,
|
||||
stripe_row_count int,
|
||||
compression name);
|
||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_cstore_table_reset(
|
||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||
table_name regclass,
|
||||
block_row_count bool,
|
||||
stripe_row_count bool,
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION cstore.cstore_tableam_handler(internal)
|
||||
RETURNS table_am_handler
|
||||
LANGUAGE C
|
||||
AS 'MODULE_PATHNAME', 'cstore_tableam_handler';
|
||||
|
||||
COMMENT ON FUNCTION cstore.cstore_tableam_handler(internal)
|
||||
IS 'internal function returning the handler for cstore tables';
|
||||
|
||||
CREATE ACCESS METHOD cstore_tableam TYPE TABLE HANDLER cstore.cstore_tableam_handler;
|
|
@ -1,9 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION cstore.cstore_tableam_handler(internal)
|
||||
RETURNS table_am_handler
|
||||
LANGUAGE C
|
||||
AS 'MODULE_PATHNAME', 'cstore_tableam_handler';
|
||||
|
||||
COMMENT ON FUNCTION cstore.cstore_tableam_handler(internal)
|
||||
IS 'internal function returning the handler for cstore tables';
|
||||
|
||||
CREATE ACCESS METHOD cstore_tableam TYPE TABLE HANDLER cstore.cstore_tableam_handler;
|
|
@ -7,7 +7,7 @@
|
|||
#include "access/skey.h"
|
||||
#include "nodes/bitmapset.h"
|
||||
|
||||
const TableAmRoutine * GetCstoreTableAmRoutine(void);
|
||||
const TableAmRoutine * GetColumnarTableAmRoutine(void);
|
||||
extern void cstore_tableam_init(void);
|
||||
extern void cstore_tableam_finish(void);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--
|
||||
-- Testing ALTER TABLE on cstore_fdw tables.
|
||||
--
|
||||
CREATE TABLE test_alter_table (a int, b int, c int) USING cstore_tableam;
|
||||
CREATE TABLE test_alter_table (a int, b int, c int) USING columnar;
|
||||
WITH sample_data AS (VALUES
|
||||
(1, 2, 3),
|
||||
(4, 5, 6),
|
||||
|
|
|
@ -25,7 +25,7 @@ SELECT :cstore_data_files_before_drop - count(*) FROM cstore.cstore_data_files;
|
|||
|
||||
-- Create a cstore_fdw table under a schema and drop it.
|
||||
CREATE SCHEMA test_schema;
|
||||
CREATE TABLE test_schema.test_table(data int) USING cstore_tableam;
|
||||
CREATE TABLE test_schema.test_table(data int) USING columnar;
|
||||
SELECT count(*) AS cstore_data_files_before_drop FROM cstore.cstore_data_files \gset
|
||||
DROP SCHEMA test_schema CASCADE;
|
||||
NOTICE: drop cascades to table test_schema.test_table
|
||||
|
@ -43,12 +43,12 @@ HINT: You can manually create a database and its extensions on workers.
|
|||
\c db_to_drop
|
||||
CREATE EXTENSION citus;
|
||||
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
|
||||
CREATE TABLE test_table(data int) USING cstore_tableam;
|
||||
CREATE TABLE test_table(data int) USING columnar;
|
||||
DROP EXTENSION citus CASCADE;
|
||||
NOTICE: drop cascades to table test_table
|
||||
-- test database drop
|
||||
CREATE EXTENSION citus;
|
||||
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
|
||||
CREATE TABLE test_table(data int) USING cstore_tableam;
|
||||
CREATE TABLE test_table(data int) USING columnar;
|
||||
\c :datname
|
||||
DROP DATABASE db_to_drop;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--
|
||||
-- Test utility functions for cstore_fdw tables.
|
||||
--
|
||||
CREATE TABLE empty_table (a int) USING cstore_tableam;
|
||||
CREATE TABLE table_with_data (a int) USING cstore_tableam;
|
||||
CREATE TABLE empty_table (a int) USING columnar;
|
||||
CREATE TABLE table_with_data (a int) USING columnar;
|
||||
CREATE TABLE non_cstore_table (a int);
|
||||
COPY table_with_data FROM STDIN;
|
||||
SELECT pg_relation_size('empty_table') < pg_relation_size('table_with_data');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--
|
||||
-- Testing insert on cstore_fdw tables.
|
||||
--
|
||||
CREATE TABLE test_insert_command (a int) USING cstore_tableam;
|
||||
CREATE TABLE test_insert_command (a int) USING columnar;
|
||||
-- test single row inserts fail
|
||||
select count(*) from test_insert_command;
|
||||
count
|
||||
|
@ -58,7 +58,7 @@ CREATE TABLE test_long_text_hash AS
|
|||
SELECT int_val, md5(text_val) AS hash
|
||||
FROM test_long_text;
|
||||
CREATE TABLE test_cstore_long_text(int_val int, text_val text)
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
-- store long text in cstore table
|
||||
INSERT INTO test_cstore_long_text SELECT * FROM test_long_text;
|
||||
-- drop source table to remove original text from toast
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
CREATE SCHEMA am_cstore_join;
|
||||
SET search_path TO am_cstore_join;
|
||||
CREATE TABLE users (id int, name text) USING cstore_tableam;
|
||||
CREATE TABLE users (id int, name text) USING columnar;
|
||||
INSERT INTO users SELECT a, 'name' || a FROM generate_series(0,30-1) AS a;
|
||||
CREATE TABLE things (id int, user_id int, name text) USING cstore_tableam;
|
||||
CREATE TABLE things (id int, user_id int, name text) USING columnar;
|
||||
INSERT INTO things SELECT a, a % 30, 'thing' || a FROM generate_series(1,300) AS a;
|
||||
-- force the nested loop to rescan the table
|
||||
SET enable_material TO off;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
--
|
||||
-- Testing we materialized views properly
|
||||
--
|
||||
CREATE TABLE t(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t(a int, b int) USING columnar;
|
||||
INSERT INTO t SELECT floor(i / 4), 2 * i FROM generate_series(1, 10) i;
|
||||
CREATE MATERIALIZED VIEW t_view(a, bsum, cnt) USING cstore_tableam AS
|
||||
CREATE MATERIALIZED VIEW t_view(a, bsum, cnt) USING columnar AS
|
||||
SELECT a, sum(b), count(*) FROM t GROUP BY a;
|
||||
SELECT * FROM t_view a ORDER BY a;
|
||||
a | bsum | cnt
|
||||
|
|
|
@ -83,8 +83,8 @@ SELECT to_json(v) FROM contestant v ORDER BY rating LIMIT 1;
|
|||
(1 row)
|
||||
|
||||
-- Test variables used in expressions
|
||||
CREATE TABLE union_first (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE union_second (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE union_first (a int, b int) USING columnar;
|
||||
CREATE TABLE union_second (a int, b int) USING columnar;
|
||||
INSERT INTO union_first SELECT a, a FROM generate_series(1, 5) a;
|
||||
INSERT INTO union_second SELECT a, a FROM generate_series(11, 15) a;
|
||||
(SELECT a*1, b FROM union_first) union all (SELECT a*1, b FROM union_second);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE TABLE t1(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t2(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t1(a int, b int) USING columnar;
|
||||
CREATE TABLE t2(a int, b int) USING columnar;
|
||||
CREATE FUNCTION f(x INT) RETURNS INT AS $$
|
||||
INSERT INTO t1 VALUES(x, x * 2) RETURNING b - 1;
|
||||
$$ LANGUAGE SQL;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--
|
||||
-- Testing we handle rollbacks properly
|
||||
--
|
||||
CREATE TABLE t(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t(a int, b int) USING columnar;
|
||||
BEGIN;
|
||||
INSERT INTO t SELECT i, i+1 FROM generate_series(1, 10) i;
|
||||
ROLLBACK;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
CREATE SCHEMA am_tableoptions;
|
||||
SET search_path TO am_tableoptions;
|
||||
CREATE TABLE table_options (a int) USING cstore_tableam;
|
||||
CREATE TABLE table_options (a int) USING columnar;
|
||||
INSERT INTO table_options SELECT generate_series(1,100);
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
|
@ -11,14 +11,14 @@ WHERE regclass = 'table_options'::regclass;
|
|||
(1 row)
|
||||
|
||||
-- test changing the compression
|
||||
SELECT alter_cstore_table_set('table_options', compression => 'pglz');
|
||||
alter_cstore_table_set
|
||||
SELECT alter_columnar_table_set('table_options', compression => 'pglz');
|
||||
alter_columnar_table_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
|
@ -26,14 +26,14 @@ WHERE regclass = 'table_options'::regclass;
|
|||
(1 row)
|
||||
|
||||
-- test changing the block_row_count
|
||||
SELECT alter_cstore_table_set('table_options', block_row_count => 10);
|
||||
alter_cstore_table_set
|
||||
SELECT alter_columnar_table_set('table_options', block_row_count => 10);
|
||||
alter_columnar_table_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
|
@ -41,14 +41,14 @@ WHERE regclass = 'table_options'::regclass;
|
|||
(1 row)
|
||||
|
||||
-- test changing the block_row_count
|
||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
|
||||
alter_cstore_table_set
|
||||
SELECT alter_columnar_table_set('table_options', stripe_row_count => 100);
|
||||
alter_columnar_table_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_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 table_options;
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
|
@ -66,14 +66,14 @@ WHERE regclass = 'table_options'::regclass;
|
|||
(1 row)
|
||||
|
||||
-- set all settings at the same time
|
||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
||||
alter_cstore_table_set
|
||||
SELECT alter_columnar_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
||||
alter_columnar_table_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
|
@ -86,49 +86,49 @@ SET cstore.stripe_row_count TO 10000;
|
|||
SET cstore.compression TO 'pglz';
|
||||
-- verify setting the GUC's didn't change the settings
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
table_options | 100 | 1000 | none
|
||||
(1 row)
|
||||
|
||||
SELECT alter_cstore_table_reset('table_options', block_row_count => true);
|
||||
alter_cstore_table_reset
|
||||
SELECT alter_columnar_table_reset('table_options', block_row_count => true);
|
||||
alter_columnar_table_reset
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
table_options | 1000 | 1000 | none
|
||||
(1 row)
|
||||
|
||||
SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
|
||||
alter_cstore_table_reset
|
||||
SELECT alter_columnar_table_reset('table_options', stripe_row_count => true);
|
||||
alter_columnar_table_reset
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
table_options | 1000 | 10000 | none
|
||||
(1 row)
|
||||
|
||||
SELECT alter_cstore_table_reset('table_options', compression => true);
|
||||
alter_cstore_table_reset
|
||||
SELECT alter_columnar_table_reset('table_options', compression => true);
|
||||
alter_columnar_table_reset
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
|
@ -140,25 +140,25 @@ SET cstore.block_row_count TO 10000;
|
|||
SET cstore.stripe_row_count TO 100000;
|
||||
SET cstore.compression TO 'none';
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
table_options | 1000 | 10000 | pglz
|
||||
(1 row)
|
||||
|
||||
SELECT alter_cstore_table_reset(
|
||||
SELECT alter_columnar_table_reset(
|
||||
'table_options',
|
||||
block_row_count => true,
|
||||
stripe_row_count => true,
|
||||
compression => true);
|
||||
alter_cstore_table_reset
|
||||
alter_columnar_table_reset
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
regclass | block_row_count | stripe_row_count | compression
|
||||
---------------------------------------------------------------------
|
||||
|
@ -168,12 +168,12 @@ WHERE regclass = 'table_options'::regclass;
|
|||
-- verify edge cases
|
||||
-- first start with a table that is not a cstore table
|
||||
CREATE TABLE not_a_cstore_table (a int);
|
||||
SELECT alter_cstore_table_set('not_a_cstore_table', compression => 'pglz');
|
||||
SELECT alter_columnar_table_set('not_a_cstore_table', compression => 'pglz');
|
||||
ERROR: table not_a_cstore_table is not a cstore table
|
||||
SELECT alter_cstore_table_reset('not_a_cstore_table', compression => true);
|
||||
SELECT alter_columnar_table_reset('not_a_cstore_table', compression => true);
|
||||
ERROR: table not_a_cstore_table is not a cstore table
|
||||
-- verify you can't use a compression that is not known
|
||||
SELECT alter_cstore_table_set('table_options', compression => 'foobar');
|
||||
SELECT alter_columnar_table_set('table_options', compression => 'foobar');
|
||||
ERROR: unknown compression type for cstore table: foobar
|
||||
SET client_min_messages TO warning;
|
||||
DROP SCHEMA am_tableoptions CASCADE;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--
|
||||
-- Testing we handle transactions properly
|
||||
--
|
||||
CREATE TABLE t(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t(a int, b int) USING columnar;
|
||||
INSERT INTO t SELECT i, 2 * i FROM generate_series(1, 3) i;
|
||||
SELECT * FROM t ORDER BY a;
|
||||
a | b
|
||||
|
|
|
@ -35,7 +35,7 @@ BEGIN
|
|||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
create table test_tr(i int) using cstore_tableam;
|
||||
create table test_tr(i int) using columnar;
|
||||
create trigger tr_before_stmt before insert on test_tr
|
||||
for each statement execute procedure trs_before();
|
||||
create trigger tr_after_stmt after insert on test_tr
|
||||
|
@ -84,7 +84,7 @@ SELECT * FROM test_tr ORDER BY i;
|
|||
(4 rows)
|
||||
|
||||
drop table test_tr;
|
||||
create table test_tr(i int) using cstore_tableam;
|
||||
create table test_tr(i int) using columnar;
|
||||
-- we should be able to clean-up and continue gracefully if we
|
||||
-- error out in AFTER STATEMENT triggers.
|
||||
CREATE SEQUENCE counter START 100;
|
||||
|
@ -126,12 +126,12 @@ create table events(
|
|||
PARTITION BY RANGE (event_time);
|
||||
create table events_p2020_11_04_102965
|
||||
PARTITION OF events FOR VALUES FROM ('2020-11-04 00:00:00+01') TO ('2020-11-05 00:00:00+01')
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
create table events_trigger_target(
|
||||
user_id bigint,
|
||||
avg float,
|
||||
__count__ bigint
|
||||
) USING cstore_tableam;
|
||||
) USING columnar;
|
||||
CREATE OR REPLACE FUNCTION user_value_by_day()
|
||||
RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
|
|
|
@ -10,10 +10,10 @@ SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten;
|
|||
(1 row)
|
||||
|
||||
-- CREATE a cstore_fdw table, fill with some data --
|
||||
CREATE TABLE cstore_truncate_test (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_truncate_test_second (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_truncate_test (a int, b int) USING columnar;
|
||||
CREATE TABLE cstore_truncate_test_second (a int, b int) USING columnar;
|
||||
-- COMPRESSED
|
||||
CREATE TABLE cstore_truncate_test_compressed (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_truncate_test_compressed (a int, b int) USING columnar;
|
||||
CREATE TABLE cstore_truncate_test_regular (a int, b int);
|
||||
SELECT count(*) AS cstore_data_files_before_truncate FROM cstore.cstore_data_files \gset
|
||||
INSERT INTO cstore_truncate_test select a, a from generate_series(1, 10) a;
|
||||
|
@ -155,7 +155,7 @@ SELECT :cstore_data_files_before_truncate - count(*) FROM cstore.cstore_data_fil
|
|||
|
||||
-- test if truncation in the same transaction that created the table works properly
|
||||
BEGIN;
|
||||
CREATE TABLE cstore_same_transaction_truncate(a int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_same_transaction_truncate(a int) USING columnar;
|
||||
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(1, 100);
|
||||
TRUNCATE cstore_same_transaction_truncate;
|
||||
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(20, 23);
|
||||
|
@ -204,7 +204,7 @@ DROP TABLE cstore_truncate_test_compressed;
|
|||
-- test truncate with schema
|
||||
CREATE SCHEMA truncate_schema;
|
||||
-- COMPRESSED
|
||||
CREATE TABLE truncate_schema.truncate_tbl (id int) USING cstore_tableam;
|
||||
CREATE TABLE truncate_schema.truncate_tbl (id int) USING columnar;
|
||||
set cstore.compression = 'pglz';
|
||||
INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100);
|
||||
set cstore.compression to default;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SELECT count(*) AS columnar_table_count FROM cstore.cstore_data_files \gset
|
||||
CREATE TABLE t(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t(a int, b int) USING columnar;
|
||||
SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.relfilenode AND b.relname='t';
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
|
@ -36,8 +36,8 @@ SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.r
|
|||
(1 row)
|
||||
|
||||
-- test the case when all data cannot fit into a single stripe
|
||||
SELECT alter_cstore_table_set('t', stripe_row_count => 1000);
|
||||
alter_cstore_table_set
|
||||
SELECT alter_columnar_table_set('t', stripe_row_count => 1000);
|
||||
alter_columnar_table_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -162,11 +162,11 @@ SELECT count(*) FROM t;
|
|||
-- add some stripes with different compression types and create some gaps,
|
||||
-- then vacuum to print stats
|
||||
BEGIN;
|
||||
SELECT alter_cstore_table_set('t',
|
||||
SELECT alter_columnar_table_set('t',
|
||||
block_row_count => 1000,
|
||||
stripe_row_count => 2000,
|
||||
compression => 'pglz');
|
||||
alter_cstore_table_set
|
||||
alter_columnar_table_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -175,8 +175,8 @@ SAVEPOINT s1;
|
|||
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
||||
ROLLBACK TO SAVEPOINT s1;
|
||||
INSERT INTO t SELECT i / 5 FROM generate_series(1, 1500) i;
|
||||
SELECT alter_cstore_table_set('t', compression => 'none');
|
||||
alter_cstore_table_set
|
||||
SELECT alter_columnar_table_set('t', compression => 'none');
|
||||
alter_columnar_table_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -211,8 +211,8 @@ block count: 11, containing data for dropped columns: 2, none compressed: 9, pgl
|
|||
-- vacuum full should remove blocks for dropped columns
|
||||
-- note that, a block will be stored in non-compressed for if compression
|
||||
-- doesn't reduce its size.
|
||||
SELECT alter_cstore_table_set('t', compression => 'pglz');
|
||||
alter_cstore_table_set
|
||||
SELECT alter_columnar_table_set('t', compression => 'pglz');
|
||||
alter_columnar_table_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
|
|
@ -477,22 +477,22 @@ ALTER EXTENSION citus UPDATE TO '10.0-1';
|
|||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| access method cstore_tableam
|
||||
| access method columnar
|
||||
| event trigger cstore_ddl_event_end
|
||||
| foreign-data wrapper cstore_fdw
|
||||
| function alter_cstore_table_reset(regclass,boolean,boolean,boolean)
|
||||
| function alter_cstore_table_set(regclass,integer,integer,name)
|
||||
| function alter_columnar_table_reset(regclass,boolean,boolean,boolean)
|
||||
| function alter_columnar_table_set(regclass,integer,integer,name)
|
||||
| function citus_internal.cstore_ensure_objects_exist()
|
||||
| function cstore.columnar_handler(internal)
|
||||
| function cstore.cstore_ddl_event_end_trigger()
|
||||
| function cstore.cstore_fdw_handler()
|
||||
| function cstore.cstore_fdw_validator(text[],oid)
|
||||
| function cstore.cstore_tableam_handler(internal)
|
||||
| function cstore_table_size(regclass)
|
||||
| schema cstore
|
||||
| table cstore.cstore_data_files
|
||||
| table cstore.cstore_skipnodes
|
||||
| table cstore.cstore_stripes
|
||||
| view cstore.cstore_options
|
||||
| view cstore.columnar_options
|
||||
(16 rows)
|
||||
|
||||
DROP TABLE prev_objects, extension_diff;
|
||||
|
|
|
@ -488,7 +488,7 @@ SELECT * FROM print_extension_changes();
|
|||
| table cstore.cstore_data_files
|
||||
| table cstore.cstore_skipnodes
|
||||
| table cstore.cstore_stripes
|
||||
| view cstore.cstore_options
|
||||
| view cstore.columnar_options
|
||||
(12 rows)
|
||||
|
||||
DROP TABLE prev_objects, extension_diff;
|
||||
|
|
|
@ -16,12 +16,12 @@ WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass
|
|||
ORDER BY 1;
|
||||
description
|
||||
---------------------------------------------------------------------
|
||||
access method cstore_tableam
|
||||
access method columnar
|
||||
event trigger citus_cascade_to_partition
|
||||
event trigger cstore_ddl_event_end
|
||||
foreign-data wrapper cstore_fdw
|
||||
function alter_cstore_table_reset(regclass,boolean,boolean,boolean)
|
||||
function alter_cstore_table_set(regclass,integer,integer,name)
|
||||
function alter_columnar_table_reset(regclass,boolean,boolean,boolean)
|
||||
function alter_columnar_table_set(regclass,integer,integer,name)
|
||||
function alter_role_if_exists(text,text)
|
||||
function any_value(anyelement)
|
||||
function any_value_agg(anyelement,anyelement)
|
||||
|
@ -82,10 +82,10 @@ ORDER BY 1;
|
|||
function create_distributed_table(regclass,text,citus.distribution_type,text)
|
||||
function create_intermediate_result(text,text)
|
||||
function create_reference_table(regclass)
|
||||
function cstore.columnar_handler(internal)
|
||||
function cstore.cstore_ddl_event_end_trigger()
|
||||
function cstore.cstore_fdw_handler()
|
||||
function cstore.cstore_fdw_validator(text[],oid)
|
||||
function cstore.cstore_tableam_handler(internal)
|
||||
function cstore_table_size(regclass)
|
||||
function distributed_tables_colocated(regclass,regclass)
|
||||
function dump_global_wait_edges()
|
||||
|
@ -221,7 +221,7 @@ ORDER BY 1;
|
|||
view citus_shards_on_worker
|
||||
view citus_stat_statements
|
||||
view citus_worker_stat_activity
|
||||
view cstore.cstore_options
|
||||
view cstore.columnar_options
|
||||
view pg_dist_shard_placement
|
||||
(207 rows)
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ ORDER BY 1;
|
|||
view citus_shards_on_worker
|
||||
view citus_stat_statements
|
||||
view citus_worker_stat_activity
|
||||
view cstore.cstore_options
|
||||
view cstore.columnar_options
|
||||
view pg_dist_shard_placement
|
||||
(203 rows)
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ $$ LANGUAGE PLPGSQL;
|
|||
set cstore.stripe_row_count = 2000;
|
||||
set cstore.block_row_count = 1000;
|
||||
CREATE TABLE test_block_filtering (a int)
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
|
||||
COPY test_block_filtering FROM '@abs_srcdir@/data/block_filtering.csv' WITH CSV;
|
||||
|
||||
|
@ -63,7 +63,7 @@ set cstore.block_row_count to default;
|
|||
|
||||
-- Verify that we are fine with collations which use a different alphabet order
|
||||
CREATE TABLE collation_block_filtering_test(A text collate "da_DK")
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
COPY collation_block_filtering_test FROM STDIN;
|
||||
A
|
||||
Å
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
|
||||
-- load table data from file
|
||||
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
-- Create uncompressed table
|
||||
CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
|
||||
|
||||
-- Create compressed table with automatically determined file path
|
||||
-- COMPRESSED
|
||||
CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
|
||||
-- Test that querying an empty table works
|
||||
ANALYZE contestant;
|
||||
|
|
|
@ -11,7 +11,7 @@ SET intervalstyle TO 'POSTGRES_VERBOSE';
|
|||
|
||||
-- Test array types
|
||||
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
|
||||
text_array text[]) USING cstore_tableam;
|
||||
text_array text[]) USING columnar;
|
||||
|
||||
COPY test_array_types FROM '@abs_srcdir@/data/array_types.csv' WITH CSV;
|
||||
|
||||
|
@ -21,7 +21,7 @@ SELECT * FROM test_array_types;
|
|||
-- Test date/time types
|
||||
CREATE TABLE test_datetime_types (timestamp timestamp,
|
||||
timestamp_with_timezone timestamp with time zone, date date, time time,
|
||||
interval interval) USING cstore_tableam;
|
||||
interval interval) USING columnar;
|
||||
|
||||
COPY test_datetime_types FROM '@abs_srcdir@/data/datetime_types.csv' WITH CSV;
|
||||
|
||||
|
@ -33,7 +33,7 @@ CREATE TYPE enum_type AS ENUM ('a', 'b', 'c');
|
|||
CREATE TYPE composite_type AS (a int, b text);
|
||||
|
||||
CREATE TABLE test_enum_and_composite_types (enum enum_type,
|
||||
composite composite_type) USING cstore_tableam;
|
||||
composite composite_type) USING columnar;
|
||||
|
||||
COPY test_enum_and_composite_types FROM
|
||||
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV;
|
||||
|
@ -43,7 +43,7 @@ SELECT * FROM test_enum_and_composite_types;
|
|||
|
||||
-- Test range types
|
||||
CREATE TABLE test_range_types (int4range int4range, int8range int8range,
|
||||
numrange numrange, tsrange tsrange) USING cstore_tableam;
|
||||
numrange numrange, tsrange tsrange) USING columnar;
|
||||
|
||||
COPY test_range_types FROM '@abs_srcdir@/data/range_types.csv' WITH CSV;
|
||||
|
||||
|
@ -52,7 +52,7 @@ SELECT * FROM test_range_types;
|
|||
|
||||
-- Test other types
|
||||
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
|
||||
inet inet, bitstring bit varying(5), uuid uuid, json json) USING cstore_tableam;
|
||||
inet inet, bitstring bit varying(5), uuid uuid, json json) USING columnar;
|
||||
|
||||
COPY test_other_types FROM '@abs_srcdir@/data/other_types.csv' WITH CSV;
|
||||
|
||||
|
@ -61,7 +61,7 @@ SELECT * FROM test_other_types;
|
|||
|
||||
-- Test null values
|
||||
CREATE TABLE test_null_values (a int, b int[], c composite_type)
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
|
||||
COPY test_null_values FROM '@abs_srcdir@/data/null_values.csv' WITH CSV;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ set cstore.compression to default;
|
|||
|
||||
-- Test column list
|
||||
CREATE TABLE famous_constants (id int, name text, value real)
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
COPY famous_constants (value, name, id) FROM STDIN WITH CSV;
|
||||
3.141,pi,1
|
||||
2.718,e,2
|
||||
|
|
|
@ -28,7 +28,7 @@ $$ LANGUAGE PLPGSQL;
|
|||
set cstore.stripe_row_count = 2000;
|
||||
set cstore.block_row_count = 1000;
|
||||
CREATE TABLE test_block_filtering (a int)
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
COPY test_block_filtering FROM '@abs_srcdir@/data/block_filtering.csv' WITH CSV;
|
||||
-- Verify that filtered_row_count is less than 1000 for the following queries
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering');
|
||||
|
@ -110,7 +110,7 @@ set cstore.stripe_row_count to default;
|
|||
set cstore.block_row_count to default;
|
||||
-- Verify that we are fine with collations which use a different alphabet order
|
||||
CREATE TABLE collation_block_filtering_test(A text collate "da_DK")
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
COPY collation_block_filtering_test FROM STDIN;
|
||||
SELECT * FROM collation_block_filtering_test WHERE A > 'B';
|
||||
a
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
-- load table data from file
|
||||
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
||||
-- export using COPY table TO ...
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
-- Create uncompressed table
|
||||
CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
-- Create compressed table with automatically determined file path
|
||||
-- COMPRESSED
|
||||
CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
-- Test that querying an empty table works
|
||||
ANALYZE contestant;
|
||||
SELECT count(*) FROM contestant;
|
||||
|
|
|
@ -7,7 +7,7 @@ SET timezone to 'GMT';
|
|||
SET intervalstyle TO 'POSTGRES_VERBOSE';
|
||||
-- Test array types
|
||||
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
|
||||
text_array text[]) USING cstore_tableam;
|
||||
text_array text[]) USING columnar;
|
||||
COPY test_array_types FROM '@abs_srcdir@/data/array_types.csv' WITH CSV;
|
||||
SELECT * FROM test_array_types;
|
||||
int_array | bigint_array | text_array
|
||||
|
@ -20,7 +20,7 @@ SELECT * FROM test_array_types;
|
|||
-- Test date/time types
|
||||
CREATE TABLE test_datetime_types (timestamp timestamp,
|
||||
timestamp_with_timezone timestamp with time zone, date date, time time,
|
||||
interval interval) USING cstore_tableam;
|
||||
interval interval) USING columnar;
|
||||
COPY test_datetime_types FROM '@abs_srcdir@/data/datetime_types.csv' WITH CSV;
|
||||
SELECT * FROM test_datetime_types;
|
||||
timestamp | timestamp_with_timezone | date | time | interval
|
||||
|
@ -33,7 +33,7 @@ SELECT * FROM test_datetime_types;
|
|||
CREATE TYPE enum_type AS ENUM ('a', 'b', 'c');
|
||||
CREATE TYPE composite_type AS (a int, b text);
|
||||
CREATE TABLE test_enum_and_composite_types (enum enum_type,
|
||||
composite composite_type) USING cstore_tableam;
|
||||
composite composite_type) USING columnar;
|
||||
COPY test_enum_and_composite_types FROM
|
||||
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV;
|
||||
SELECT * FROM test_enum_and_composite_types;
|
||||
|
@ -45,7 +45,7 @@ SELECT * FROM test_enum_and_composite_types;
|
|||
|
||||
-- Test range types
|
||||
CREATE TABLE test_range_types (int4range int4range, int8range int8range,
|
||||
numrange numrange, tsrange tsrange) USING cstore_tableam;
|
||||
numrange numrange, tsrange tsrange) USING columnar;
|
||||
COPY test_range_types FROM '@abs_srcdir@/data/range_types.csv' WITH CSV;
|
||||
SELECT * FROM test_range_types;
|
||||
int4range | int8range | numrange | tsrange
|
||||
|
@ -56,7 +56,7 @@ SELECT * FROM test_range_types;
|
|||
|
||||
-- Test other types
|
||||
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
|
||||
inet inet, bitstring bit varying(5), uuid uuid, json json) USING cstore_tableam;
|
||||
inet inet, bitstring bit varying(5), uuid uuid, json json) USING columnar;
|
||||
COPY test_other_types FROM '@abs_srcdir@/data/other_types.csv' WITH CSV;
|
||||
SELECT * FROM test_other_types;
|
||||
bool | bytea | money | inet | bitstring | uuid | json
|
||||
|
@ -67,7 +67,7 @@ SELECT * FROM test_other_types;
|
|||
|
||||
-- Test null values
|
||||
CREATE TABLE test_null_values (a int, b int[], c composite_type)
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
COPY test_null_values FROM '@abs_srcdir@/data/null_values.csv' WITH CSV;
|
||||
SELECT * FROM test_null_values;
|
||||
a | b | c
|
||||
|
|
|
@ -23,7 +23,7 @@ COPY contestant_compressed FROM PROGRAM 'cat @abs_srcdir@/data/contestants.2.csv
|
|||
set cstore.compression to default;
|
||||
-- Test column list
|
||||
CREATE TABLE famous_constants (id int, name text, value real)
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
COPY famous_constants (value, name, id) FROM STDIN WITH CSV;
|
||||
COPY famous_constants (name, value) FROM STDIN WITH CSV;
|
||||
SELECT * FROM famous_constants ORDER BY id, name;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
setup
|
||||
{
|
||||
CREATE TABLE test_vacuum_vs_insert (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE test_vacuum_vs_insert (a int, b int) USING columnar;
|
||||
}
|
||||
|
||||
teardown
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
setup
|
||||
{
|
||||
CREATE TABLE test_insert_concurrency (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE test_insert_concurrency (a int, b int) USING columnar;
|
||||
}
|
||||
|
||||
teardown
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-- Testing ALTER TABLE on cstore_fdw tables.
|
||||
--
|
||||
|
||||
CREATE TABLE test_alter_table (a int, b int, c int) USING cstore_tableam;
|
||||
CREATE TABLE test_alter_table (a int, b int, c int) USING columnar;
|
||||
|
||||
WITH sample_data AS (VALUES
|
||||
(1, 2, 3),
|
||||
|
|
|
@ -26,7 +26,7 @@ SELECT :cstore_data_files_before_drop - count(*) FROM cstore.cstore_data_files;
|
|||
|
||||
-- Create a cstore_fdw table under a schema and drop it.
|
||||
CREATE SCHEMA test_schema;
|
||||
CREATE TABLE test_schema.test_table(data int) USING cstore_tableam;
|
||||
CREATE TABLE test_schema.test_table(data int) USING columnar;
|
||||
|
||||
SELECT count(*) AS cstore_data_files_before_drop FROM cstore.cstore_data_files \gset
|
||||
DROP SCHEMA test_schema CASCADE;
|
||||
|
@ -39,7 +39,7 @@ CREATE DATABASE db_to_drop;
|
|||
CREATE EXTENSION citus;
|
||||
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
|
||||
|
||||
CREATE TABLE test_table(data int) USING cstore_tableam;
|
||||
CREATE TABLE test_table(data int) USING columnar;
|
||||
|
||||
DROP EXTENSION citus CASCADE;
|
||||
|
||||
|
@ -47,7 +47,7 @@ DROP EXTENSION citus CASCADE;
|
|||
CREATE EXTENSION citus;
|
||||
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
|
||||
|
||||
CREATE TABLE test_table(data int) USING cstore_tableam;
|
||||
CREATE TABLE test_table(data int) USING columnar;
|
||||
|
||||
\c :datname
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
-- Test utility functions for cstore_fdw tables.
|
||||
--
|
||||
|
||||
CREATE TABLE empty_table (a int) USING cstore_tableam;
|
||||
CREATE TABLE table_with_data (a int) USING cstore_tableam;
|
||||
CREATE TABLE empty_table (a int) USING columnar;
|
||||
CREATE TABLE table_with_data (a int) USING columnar;
|
||||
CREATE TABLE non_cstore_table (a int);
|
||||
|
||||
COPY table_with_data FROM STDIN;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-- Testing insert on cstore_fdw tables.
|
||||
--
|
||||
|
||||
CREATE TABLE test_insert_command (a int) USING cstore_tableam;
|
||||
CREATE TABLE test_insert_command (a int) USING columnar;
|
||||
|
||||
-- test single row inserts fail
|
||||
select count(*) from test_insert_command;
|
||||
|
@ -38,7 +38,7 @@ SELECT int_val, md5(text_val) AS hash
|
|||
FROM test_long_text;
|
||||
|
||||
CREATE TABLE test_cstore_long_text(int_val int, text_val text)
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
|
||||
-- store long text in cstore table
|
||||
INSERT INTO test_cstore_long_text SELECT * FROM test_long_text;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
CREATE SCHEMA am_cstore_join;
|
||||
SET search_path TO am_cstore_join;
|
||||
|
||||
CREATE TABLE users (id int, name text) USING cstore_tableam;
|
||||
CREATE TABLE users (id int, name text) USING columnar;
|
||||
INSERT INTO users SELECT a, 'name' || a FROM generate_series(0,30-1) AS a;
|
||||
|
||||
CREATE TABLE things (id int, user_id int, name text) USING cstore_tableam;
|
||||
CREATE TABLE things (id int, user_id int, name text) USING columnar;
|
||||
INSERT INTO things SELECT a, a % 30, 'thing' || a FROM generate_series(1,300) AS a;
|
||||
|
||||
-- force the nested loop to rescan the table
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
-- Testing we materialized views properly
|
||||
--
|
||||
|
||||
CREATE TABLE t(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t(a int, b int) USING columnar;
|
||||
|
||||
INSERT INTO t SELECT floor(i / 4), 2 * i FROM generate_series(1, 10) i;
|
||||
|
||||
CREATE MATERIALIZED VIEW t_view(a, bsum, cnt) USING cstore_tableam AS
|
||||
CREATE MATERIALIZED VIEW t_view(a, bsum, cnt) USING columnar AS
|
||||
SELECT a, sum(b), count(*) FROM t GROUP BY a;
|
||||
|
||||
SELECT * FROM t_view a ORDER BY a;
|
||||
|
|
|
@ -23,8 +23,8 @@ SELECT * FROM contestant_compressed ORDER BY handle;
|
|||
SELECT to_json(v) FROM contestant v ORDER BY rating LIMIT 1;
|
||||
|
||||
-- Test variables used in expressions
|
||||
CREATE TABLE union_first (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE union_second (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE union_first (a int, b int) USING columnar;
|
||||
CREATE TABLE union_second (a int, b int) USING columnar;
|
||||
|
||||
INSERT INTO union_first SELECT a, a FROM generate_series(1, 5) a;
|
||||
INSERT INTO union_second SELECT a, a FROM generate_series(11, 15) a;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
CREATE TABLE t1(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t2(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t1(a int, b int) USING columnar;
|
||||
CREATE TABLE t2(a int, b int) USING columnar;
|
||||
|
||||
CREATE FUNCTION f(x INT) RETURNS INT AS $$
|
||||
INSERT INTO t1 VALUES(x, x * 2) RETURNING b - 1;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-- Testing we handle rollbacks properly
|
||||
--
|
||||
|
||||
CREATE TABLE t(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t(a int, b int) USING columnar;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t SELECT i, i+1 FROM generate_series(1, 10) i;
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
CREATE SCHEMA am_tableoptions;
|
||||
SET search_path TO am_tableoptions;
|
||||
|
||||
CREATE TABLE table_options (a int) USING cstore_tableam;
|
||||
CREATE TABLE table_options (a int) USING columnar;
|
||||
INSERT INTO table_options SELECT generate_series(1,100);
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
-- test changing the compression
|
||||
SELECT alter_cstore_table_set('table_options', compression => 'pglz');
|
||||
SELECT alter_columnar_table_set('table_options', compression => 'pglz');
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
-- test changing the block_row_count
|
||||
SELECT alter_cstore_table_set('table_options', block_row_count => 10);
|
||||
SELECT alter_columnar_table_set('table_options', block_row_count => 10);
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
-- test changing the block_row_count
|
||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
|
||||
SELECT alter_columnar_table_set('table_options', stripe_row_count => 100);
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
-- VACUUM FULL creates a new table, make sure it copies settings from the table you are vacuuming
|
||||
VACUUM FULL table_options;
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
-- set all settings at the same time
|
||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
||||
SELECT alter_columnar_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
-- reset settings one by one to the version of the GUC's
|
||||
|
@ -50,24 +50,24 @@ SET cstore.compression TO 'pglz';
|
|||
|
||||
-- verify setting the GUC's didn't change the settings
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
SELECT alter_cstore_table_reset('table_options', block_row_count => true);
|
||||
SELECT alter_columnar_table_reset('table_options', block_row_count => true);
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
|
||||
SELECT alter_columnar_table_reset('table_options', stripe_row_count => true);
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
SELECT alter_cstore_table_reset('table_options', compression => true);
|
||||
SELECT alter_columnar_table_reset('table_options', compression => true);
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
-- verify resetting all settings at once work
|
||||
|
@ -76,27 +76,27 @@ SET cstore.stripe_row_count TO 100000;
|
|||
SET cstore.compression TO 'none';
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
SELECT alter_cstore_table_reset(
|
||||
SELECT alter_columnar_table_reset(
|
||||
'table_options',
|
||||
block_row_count => true,
|
||||
stripe_row_count => true,
|
||||
compression => true);
|
||||
|
||||
-- show table_options settings
|
||||
SELECT * FROM cstore.cstore_options
|
||||
SELECT * FROM cstore.columnar_options
|
||||
WHERE regclass = 'table_options'::regclass;
|
||||
|
||||
-- verify edge cases
|
||||
-- first start with a table that is not a cstore table
|
||||
CREATE TABLE not_a_cstore_table (a int);
|
||||
SELECT alter_cstore_table_set('not_a_cstore_table', compression => 'pglz');
|
||||
SELECT alter_cstore_table_reset('not_a_cstore_table', compression => true);
|
||||
SELECT alter_columnar_table_set('not_a_cstore_table', compression => 'pglz');
|
||||
SELECT alter_columnar_table_reset('not_a_cstore_table', compression => true);
|
||||
|
||||
-- verify you can't use a compression that is not known
|
||||
SELECT alter_cstore_table_set('table_options', compression => 'foobar');
|
||||
SELECT alter_columnar_table_set('table_options', compression => 'foobar');
|
||||
|
||||
SET client_min_messages TO warning;
|
||||
DROP SCHEMA am_tableoptions CASCADE;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-- Testing we handle transactions properly
|
||||
--
|
||||
|
||||
CREATE TABLE t(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t(a int, b int) USING columnar;
|
||||
|
||||
INSERT INTO t SELECT i, 2 * i FROM generate_series(1, 3) i;
|
||||
SELECT * FROM t ORDER BY a;
|
||||
|
|
|
@ -40,7 +40,7 @@ BEGIN
|
|||
END;
|
||||
$$;
|
||||
|
||||
create table test_tr(i int) using cstore_tableam;
|
||||
create table test_tr(i int) using columnar;
|
||||
|
||||
create trigger tr_before_stmt before insert on test_tr
|
||||
for each statement execute procedure trs_before();
|
||||
|
@ -61,7 +61,7 @@ insert into test_tr values(2),(3),(4);
|
|||
SELECT * FROM test_tr ORDER BY i;
|
||||
|
||||
drop table test_tr;
|
||||
create table test_tr(i int) using cstore_tableam;
|
||||
create table test_tr(i int) using columnar;
|
||||
|
||||
-- we should be able to clean-up and continue gracefully if we
|
||||
-- error out in AFTER STATEMENT triggers.
|
||||
|
@ -102,13 +102,13 @@ create table events(
|
|||
|
||||
create table events_p2020_11_04_102965
|
||||
PARTITION OF events FOR VALUES FROM ('2020-11-04 00:00:00+01') TO ('2020-11-05 00:00:00+01')
|
||||
USING cstore_tableam;
|
||||
USING columnar;
|
||||
|
||||
create table events_trigger_target(
|
||||
user_id bigint,
|
||||
avg float,
|
||||
__count__ bigint
|
||||
) USING cstore_tableam;
|
||||
) USING columnar;
|
||||
|
||||
CREATE OR REPLACE FUNCTION user_value_by_day()
|
||||
RETURNS trigger
|
||||
|
|
|
@ -7,10 +7,10 @@ SHOW server_version \gset
|
|||
SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten;
|
||||
|
||||
-- CREATE a cstore_fdw table, fill with some data --
|
||||
CREATE TABLE cstore_truncate_test (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_truncate_test_second (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_truncate_test (a int, b int) USING columnar;
|
||||
CREATE TABLE cstore_truncate_test_second (a int, b int) USING columnar;
|
||||
-- COMPRESSED
|
||||
CREATE TABLE cstore_truncate_test_compressed (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_truncate_test_compressed (a int, b int) USING columnar;
|
||||
CREATE TABLE cstore_truncate_test_regular (a int, b int);
|
||||
|
||||
SELECT count(*) AS cstore_data_files_before_truncate FROM cstore.cstore_data_files \gset
|
||||
|
@ -67,7 +67,7 @@ SELECT :cstore_data_files_before_truncate - count(*) FROM cstore.cstore_data_fil
|
|||
|
||||
-- test if truncation in the same transaction that created the table works properly
|
||||
BEGIN;
|
||||
CREATE TABLE cstore_same_transaction_truncate(a int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_same_transaction_truncate(a int) USING columnar;
|
||||
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(1, 100);
|
||||
TRUNCATE cstore_same_transaction_truncate;
|
||||
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(20, 23);
|
||||
|
@ -99,7 +99,7 @@ DROP TABLE cstore_truncate_test_compressed;
|
|||
-- test truncate with schema
|
||||
CREATE SCHEMA truncate_schema;
|
||||
-- COMPRESSED
|
||||
CREATE TABLE truncate_schema.truncate_tbl (id int) USING cstore_tableam;
|
||||
CREATE TABLE truncate_schema.truncate_tbl (id int) USING columnar;
|
||||
set cstore.compression = 'pglz';
|
||||
INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100);
|
||||
set cstore.compression to default;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SELECT count(*) AS columnar_table_count FROM cstore.cstore_data_files \gset
|
||||
|
||||
CREATE TABLE t(a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE t(a int, b int) USING columnar;
|
||||
|
||||
SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.relfilenode AND b.relname='t';
|
||||
|
||||
|
@ -18,7 +18,7 @@ SELECT sum(a), sum(b) FROM t;
|
|||
SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.relfilenode AND b.relname='t';
|
||||
|
||||
-- test the case when all data cannot fit into a single stripe
|
||||
SELECT alter_cstore_table_set('t', stripe_row_count => 1000);
|
||||
SELECT alter_columnar_table_set('t', stripe_row_count => 1000);
|
||||
INSERT INTO t SELECT i, 2 * i FROM generate_series(1,2500) i;
|
||||
|
||||
SELECT sum(a), sum(b) FROM t;
|
||||
|
@ -65,7 +65,7 @@ SELECT count(*) FROM t;
|
|||
-- then vacuum to print stats
|
||||
|
||||
BEGIN;
|
||||
SELECT alter_cstore_table_set('t',
|
||||
SELECT alter_columnar_table_set('t',
|
||||
block_row_count => 1000,
|
||||
stripe_row_count => 2000,
|
||||
compression => 'pglz');
|
||||
|
@ -73,7 +73,7 @@ SAVEPOINT s1;
|
|||
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
||||
ROLLBACK TO SAVEPOINT s1;
|
||||
INSERT INTO t SELECT i / 5 FROM generate_series(1, 1500) i;
|
||||
SELECT alter_cstore_table_set('t', compression => 'none');
|
||||
SELECT alter_columnar_table_set('t', compression => 'none');
|
||||
SAVEPOINT s2;
|
||||
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
|
||||
ROLLBACK TO SAVEPOINT s2;
|
||||
|
@ -94,7 +94,7 @@ VACUUM VERBOSE t;
|
|||
-- vacuum full should remove blocks for dropped columns
|
||||
-- note that, a block will be stored in non-compressed for if compression
|
||||
-- doesn't reduce its size.
|
||||
SELECT alter_cstore_table_set('t', compression => 'pglz');
|
||||
SELECT alter_columnar_table_set('t', compression => 'pglz');
|
||||
VACUUM FULL t;
|
||||
VACUUM VERBOSE t;
|
||||
|
||||
|
|
Loading…
Reference in New Issue