mirror of https://github.com/citusdata/citus.git
rename cstore_tableam -> columnar
parent
05390729f9
commit
a2b698a766
|
@ -160,7 +160,7 @@ CStoreSetRelPathlistHook(PlannerInfo *root, RelOptInfo *rel, Index rti,
|
||||||
* into the scan of the table to minimize the data read.
|
* into the scan of the table to minimize the data read.
|
||||||
*/
|
*/
|
||||||
Relation relation = RelationIdGetRelation(rte->relid);
|
Relation relation = RelationIdGetRelation(rte->relid);
|
||||||
if (relation->rd_tableam == GetCstoreTableAmRoutine())
|
if (relation->rd_tableam == GetColumnarTableAmRoutine())
|
||||||
{
|
{
|
||||||
Path *customPath = CreateCStoreScanPath(rel, rte);
|
Path *customPath = CreateCStoreScanPath(rel, rte);
|
||||||
|
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ CStoreTableAMProcessUtility(PlannedStmt * plannedStatement,
|
||||||
CreateTrigStmt *createTrigStmt = (CreateTrigStmt *) parseTree;
|
CreateTrigStmt *createTrigStmt = (CreateTrigStmt *) parseTree;
|
||||||
|
|
||||||
Relation rel = relation_openrv(createTrigStmt->relation, AccessShareLock);
|
Relation rel = relation_openrv(createTrigStmt->relation, AccessShareLock);
|
||||||
bool isCStore = rel->rd_tableam == GetCstoreTableAmRoutine();
|
bool isCStore = rel->rd_tableam == GetColumnarTableAmRoutine();
|
||||||
relation_close(rel, AccessShareLock);
|
relation_close(rel, AccessShareLock);
|
||||||
|
|
||||||
if (isCStore &&
|
if (isCStore &&
|
||||||
|
@ -1187,7 +1187,7 @@ IsCStoreTableAmTable(Oid relationId)
|
||||||
* avoid race conditions.
|
* avoid race conditions.
|
||||||
*/
|
*/
|
||||||
Relation rel = relation_open(relationId, AccessShareLock);
|
Relation rel = relation_open(relationId, AccessShareLock);
|
||||||
bool result = rel->rd_tableam == GetCstoreTableAmRoutine();
|
bool result = rel->rd_tableam == GetColumnarTableAmRoutine();
|
||||||
relation_close(rel, NoLock);
|
relation_close(rel, NoLock);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1251,15 +1251,15 @@ static const TableAmRoutine cstore_am_methods = {
|
||||||
|
|
||||||
|
|
||||||
const TableAmRoutine *
|
const TableAmRoutine *
|
||||||
GetCstoreTableAmRoutine(void)
|
GetColumnarTableAmRoutine(void)
|
||||||
{
|
{
|
||||||
return &cstore_am_methods;
|
return &cstore_am_methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PG_FUNCTION_INFO_V1(cstore_tableam_handler);
|
PG_FUNCTION_INFO_V1(columnar_handler);
|
||||||
Datum
|
Datum
|
||||||
cstore_tableam_handler(PG_FUNCTION_ARGS)
|
columnar_handler(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
PG_RETURN_POINTER(&cstore_am_methods);
|
PG_RETURN_POINTER(&cstore_am_methods);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ CREATE TABLE cstore_skipnodes (
|
||||||
|
|
||||||
COMMENT ON TABLE cstore_skipnodes IS 'CStore per block metadata';
|
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,
|
SELECT c.oid::regclass regclass,
|
||||||
d.block_row_count,
|
d.block_row_count,
|
||||||
d.stripe_row_count,
|
d.stripe_row_count,
|
||||||
|
@ -85,7 +85,7 @@ SELECT c.oid::regclass regclass,
|
||||||
FROM pg_class c
|
FROM pg_class c
|
||||||
JOIN cstore.cstore_data_files d USING(relfilenode);
|
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$
|
DO $proc$
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -95,7 +95,7 @@ BEGIN
|
||||||
-- user instead to add the missing objects
|
-- user instead to add the missing objects
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
#include "udfs/cstore_tableam_handler/10.0-1.sql"
|
#include "udfs/columnar_handler/10.0-1.sql"
|
||||||
#include "udfs/alter_cstore_table_set/10.0-1.sql"
|
#include "udfs/alter_cstore_table_set/10.0-1.sql"
|
||||||
#include "udfs/alter_cstore_table_reset/10.0-1.sql"
|
#include "udfs/alter_cstore_table_reset/10.0-1.sql"
|
||||||
$$;
|
$$;
|
||||||
|
|
|
@ -7,27 +7,27 @@ BEGIN
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
DROP FUNCTION pg_catalog.alter_cstore_table_reset(
|
DROP FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count bool,
|
block_row_count bool,
|
||||||
stripe_row_count bool,
|
stripe_row_count bool,
|
||||||
compression bool);
|
compression bool);
|
||||||
|
|
||||||
DROP FUNCTION pg_catalog.alter_cstore_table_set(
|
DROP FUNCTION pg_catalog.alter_columnar_table_set(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count int,
|
block_row_count int,
|
||||||
stripe_row_count int,
|
stripe_row_count int,
|
||||||
compression name);
|
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 IF;
|
||||||
END$proc$;
|
END$proc$;
|
||||||
|
|
||||||
DROP VIEW cstore_options;
|
DROP VIEW columnar_options;
|
||||||
DROP TABLE cstore_skipnodes;
|
DROP TABLE cstore_skipnodes;
|
||||||
DROP TABLE cstore_stripes;
|
DROP TABLE cstore_stripes;
|
||||||
DROP TABLE cstore_data_files;
|
DROP TABLE cstore_data_files;
|
||||||
|
|
|
@ -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
|
-- when postgres is version 12 or above we need to create the tableam. If the tableam
|
||||||
-- exist we assume all objects have been created.
|
-- exist we assume all objects have been created.
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
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_cstore_table_set/10.0-1.sql"
|
||||||
|
|
||||||
#include "../alter_cstore_table_reset/10.0-1.sql"
|
#include "../alter_cstore_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.cstore_tableam_handler(internal);
|
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);
|
||||||
ALTER EXTENSION citus ADD ACCESS METHOD cstore_tableam;
|
ALTER EXTENSION citus ADD ACCESS METHOD columnar;
|
||||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_cstore_table_set(
|
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_set(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count int,
|
block_row_count int,
|
||||||
stripe_row_count int,
|
stripe_row_count int,
|
||||||
compression name);
|
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,
|
table_name regclass,
|
||||||
block_row_count bool,
|
block_row_count bool,
|
||||||
stripe_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
|
-- when postgres is version 12 or above we need to create the tableam. If the tableam
|
||||||
-- exist we assume all objects have been created.
|
-- exist we assume all objects have been created.
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
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_cstore_table_set/10.0-1.sql"
|
||||||
|
|
||||||
#include "../alter_cstore_table_reset/10.0-1.sql"
|
#include "../alter_cstore_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.cstore_tableam_handler(internal);
|
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);
|
||||||
ALTER EXTENSION citus ADD ACCESS METHOD cstore_tableam;
|
ALTER EXTENSION citus ADD ACCESS METHOD columnar;
|
||||||
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_cstore_table_set(
|
ALTER EXTENSION citus ADD FUNCTION pg_catalog.alter_columnar_table_set(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
block_row_count int,
|
block_row_count int,
|
||||||
stripe_row_count int,
|
stripe_row_count int,
|
||||||
compression name);
|
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,
|
table_name regclass,
|
||||||
block_row_count bool,
|
block_row_count bool,
|
||||||
stripe_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 "access/skey.h"
|
||||||
#include "nodes/bitmapset.h"
|
#include "nodes/bitmapset.h"
|
||||||
|
|
||||||
const TableAmRoutine * GetCstoreTableAmRoutine(void);
|
const TableAmRoutine * GetColumnarTableAmRoutine(void);
|
||||||
extern void cstore_tableam_init(void);
|
extern void cstore_tableam_init(void);
|
||||||
extern void cstore_tableam_finish(void);
|
extern void cstore_tableam_finish(void);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--
|
--
|
||||||
-- Testing ALTER TABLE on cstore_fdw tables.
|
-- 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
|
WITH sample_data AS (VALUES
|
||||||
(1, 2, 3),
|
(1, 2, 3),
|
||||||
(4, 5, 6),
|
(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 a cstore_fdw table under a schema and drop it.
|
||||||
CREATE SCHEMA test_schema;
|
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
|
SELECT count(*) AS cstore_data_files_before_drop FROM cstore.cstore_data_files \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
|
||||||
|
@ -43,12 +43,12 @@ HINT: You can manually create a database and its extensions on workers.
|
||||||
\c db_to_drop
|
\c db_to_drop
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
|
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;
|
DROP EXTENSION citus CASCADE;
|
||||||
NOTICE: drop cascades to table test_table
|
NOTICE: drop cascades to table test_table
|
||||||
-- test database drop
|
-- test database drop
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
|
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
|
\c :datname
|
||||||
DROP DATABASE db_to_drop;
|
DROP DATABASE db_to_drop;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
--
|
--
|
||||||
-- Test utility functions for cstore_fdw tables.
|
-- Test utility functions for cstore_fdw tables.
|
||||||
--
|
--
|
||||||
CREATE TABLE empty_table (a int) USING cstore_tableam;
|
CREATE TABLE empty_table (a int) USING columnar;
|
||||||
CREATE TABLE table_with_data (a int) USING cstore_tableam;
|
CREATE TABLE table_with_data (a int) USING columnar;
|
||||||
CREATE TABLE non_cstore_table (a int);
|
CREATE TABLE non_cstore_table (a int);
|
||||||
COPY table_with_data FROM STDIN;
|
COPY table_with_data FROM STDIN;
|
||||||
SELECT pg_relation_size('empty_table') < pg_relation_size('table_with_data');
|
SELECT pg_relation_size('empty_table') < pg_relation_size('table_with_data');
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--
|
--
|
||||||
-- Testing insert on cstore_fdw tables.
|
-- 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
|
-- test single row inserts fail
|
||||||
select count(*) from test_insert_command;
|
select count(*) from test_insert_command;
|
||||||
count
|
count
|
||||||
|
@ -58,7 +58,7 @@ CREATE TABLE test_long_text_hash AS
|
||||||
SELECT int_val, md5(text_val) AS hash
|
SELECT int_val, md5(text_val) AS hash
|
||||||
FROM test_long_text;
|
FROM test_long_text;
|
||||||
CREATE TABLE test_cstore_long_text(int_val int, text_val text)
|
CREATE TABLE test_cstore_long_text(int_val int, text_val text)
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
-- store long text in cstore table
|
-- store long text in cstore table
|
||||||
INSERT INTO test_cstore_long_text SELECT * FROM test_long_text;
|
INSERT INTO test_cstore_long_text SELECT * FROM test_long_text;
|
||||||
-- drop source table to remove original text from toast
|
-- drop source table to remove original text from toast
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
CREATE SCHEMA am_cstore_join;
|
CREATE SCHEMA am_cstore_join;
|
||||||
SET search_path TO 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;
|
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;
|
INSERT INTO things SELECT a, a % 30, 'thing' || a FROM generate_series(1,300) AS a;
|
||||||
-- force the nested loop to rescan the table
|
-- force the nested loop to rescan the table
|
||||||
SET enable_material TO off;
|
SET enable_material TO off;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
--
|
--
|
||||||
-- Testing we materialized views properly
|
-- 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;
|
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 a, sum(b), count(*) FROM t GROUP BY a;
|
||||||
SELECT * FROM t_view a ORDER BY a;
|
SELECT * FROM t_view a ORDER BY a;
|
||||||
a | bsum | cnt
|
a | bsum | cnt
|
||||||
|
|
|
@ -83,8 +83,8 @@ SELECT to_json(v) FROM contestant v ORDER BY rating LIMIT 1;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- Test variables used in expressions
|
-- Test variables used in expressions
|
||||||
CREATE TABLE union_first (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 cstore_tableam;
|
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_first SELECT a, a FROM generate_series(1, 5) a;
|
||||||
INSERT INTO union_second SELECT a, a FROM generate_series(11, 15) 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);
|
(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 t1(a int, b int) USING columnar;
|
||||||
CREATE TABLE t2(a int, b int) USING cstore_tableam;
|
CREATE TABLE t2(a int, b int) USING columnar;
|
||||||
CREATE FUNCTION f(x INT) RETURNS INT AS $$
|
CREATE FUNCTION f(x INT) RETURNS INT AS $$
|
||||||
INSERT INTO t1 VALUES(x, x * 2) RETURNING b - 1;
|
INSERT INTO t1 VALUES(x, x * 2) RETURNING b - 1;
|
||||||
$$ LANGUAGE SQL;
|
$$ LANGUAGE SQL;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--
|
--
|
||||||
-- Testing we handle rollbacks properly
|
-- 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;
|
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;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
CREATE SCHEMA am_tableoptions;
|
CREATE SCHEMA am_tableoptions;
|
||||||
SET search_path TO 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);
|
INSERT INTO table_options SELECT generate_series(1,100);
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -18,7 +18,7 @@ SELECT alter_cstore_table_set('table_options', compression => 'pglz');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -33,7 +33,7 @@ SELECT alter_cstore_table_set('table_options', block_row_count => 10);
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -48,7 +48,7 @@ SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
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 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.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -73,7 +73,7 @@ SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_r
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -86,7 +86,7 @@ SET cstore.stripe_row_count TO 10000;
|
||||||
SET cstore.compression TO 'pglz';
|
SET cstore.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.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -100,7 +100,7 @@ SELECT alter_cstore_table_reset('table_options', block_row_count => true);
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -114,7 +114,7 @@ SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -128,7 +128,7 @@ SELECT alter_cstore_table_reset('table_options', compression => true);
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -140,7 +140,7 @@ SET cstore.block_row_count TO 10000;
|
||||||
SET cstore.stripe_row_count TO 100000;
|
SET cstore.stripe_row_count TO 100000;
|
||||||
SET cstore.compression TO 'none';
|
SET cstore.compression TO 'none';
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -158,7 +158,7 @@ SELECT alter_cstore_table_reset(
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
regclass | block_row_count | stripe_row_count | compression
|
regclass | block_row_count | stripe_row_count | compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--
|
--
|
||||||
-- Testing we handle transactions properly
|
-- 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;
|
INSERT INTO t SELECT i, 2 * i FROM generate_series(1, 3) i;
|
||||||
SELECT * FROM t ORDER BY a;
|
SELECT * FROM t ORDER BY a;
|
||||||
a | b
|
a | b
|
||||||
|
|
|
@ -35,7 +35,7 @@ BEGIN
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
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
|
create trigger tr_before_stmt before insert on test_tr
|
||||||
for each statement execute procedure trs_before();
|
for each statement execute procedure trs_before();
|
||||||
create trigger tr_after_stmt after insert on test_tr
|
create trigger tr_after_stmt after insert on test_tr
|
||||||
|
@ -84,7 +84,7 @@ SELECT * FROM test_tr ORDER BY i;
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
drop table test_tr;
|
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
|
-- we should be able to clean-up and continue gracefully if we
|
||||||
-- error out in AFTER STATEMENT triggers.
|
-- error out in AFTER STATEMENT triggers.
|
||||||
CREATE SEQUENCE counter START 100;
|
CREATE SEQUENCE counter START 100;
|
||||||
|
@ -126,12 +126,12 @@ create table events(
|
||||||
PARTITION BY RANGE (event_time);
|
PARTITION BY RANGE (event_time);
|
||||||
create table events_p2020_11_04_102965
|
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')
|
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(
|
create table events_trigger_target(
|
||||||
user_id bigint,
|
user_id bigint,
|
||||||
avg float,
|
avg float,
|
||||||
__count__ bigint
|
__count__ bigint
|
||||||
) USING cstore_tableam;
|
) USING columnar;
|
||||||
CREATE OR REPLACE FUNCTION user_value_by_day()
|
CREATE OR REPLACE FUNCTION user_value_by_day()
|
||||||
RETURNS trigger
|
RETURNS trigger
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
|
|
|
@ -10,10 +10,10 @@ SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- CREATE a cstore_fdw table, fill with some data --
|
-- 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 (a int, b int) USING columnar;
|
||||||
CREATE TABLE cstore_truncate_test_second (a int, b int) USING cstore_tableam;
|
CREATE TABLE cstore_truncate_test_second (a int, b int) USING columnar;
|
||||||
-- COMPRESSED
|
-- 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);
|
CREATE TABLE cstore_truncate_test_regular (a int, b int);
|
||||||
SELECT count(*) AS cstore_data_files_before_truncate FROM cstore.cstore_data_files \gset
|
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;
|
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
|
-- test if truncation in the same transaction that created the table works properly
|
||||||
BEGIN;
|
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);
|
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(1, 100);
|
||||||
TRUNCATE cstore_same_transaction_truncate;
|
TRUNCATE cstore_same_transaction_truncate;
|
||||||
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(20, 23);
|
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
|
-- test truncate with schema
|
||||||
CREATE SCHEMA truncate_schema;
|
CREATE SCHEMA truncate_schema;
|
||||||
-- COMPRESSED
|
-- 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';
|
set cstore.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 cstore.compression to default;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SELECT count(*) AS columnar_table_count FROM cstore.cstore_data_files \gset
|
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';
|
SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.relfilenode AND b.relname='t';
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
|
@ -477,7 +477,7 @@ ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
| access method cstore_tableam
|
| access method columnar
|
||||||
| event trigger cstore_ddl_event_end
|
| event trigger cstore_ddl_event_end
|
||||||
| foreign-data wrapper cstore_fdw
|
| foreign-data wrapper cstore_fdw
|
||||||
| function alter_cstore_table_reset(regclass,boolean,boolean,boolean)
|
| function alter_cstore_table_reset(regclass,boolean,boolean,boolean)
|
||||||
|
@ -486,13 +486,13 @@ SELECT * FROM print_extension_changes();
|
||||||
| function cstore.cstore_ddl_event_end_trigger()
|
| function cstore.cstore_ddl_event_end_trigger()
|
||||||
| function cstore.cstore_fdw_handler()
|
| function cstore.cstore_fdw_handler()
|
||||||
| function cstore.cstore_fdw_validator(text[],oid)
|
| function cstore.cstore_fdw_validator(text[],oid)
|
||||||
| function cstore.cstore_tableam_handler(internal)
|
| function cstore.columnar_handler(internal)
|
||||||
| function cstore_table_size(regclass)
|
| function cstore_table_size(regclass)
|
||||||
| schema cstore
|
| schema cstore
|
||||||
| table cstore.cstore_data_files
|
| table cstore.cstore_data_files
|
||||||
| table cstore.cstore_skipnodes
|
| table cstore.cstore_skipnodes
|
||||||
| table cstore.cstore_stripes
|
| table cstore.cstore_stripes
|
||||||
| view cstore.cstore_options
|
| view cstore.columnar_options
|
||||||
(16 rows)
|
(16 rows)
|
||||||
|
|
||||||
DROP TABLE prev_objects, extension_diff;
|
DROP TABLE prev_objects, extension_diff;
|
||||||
|
|
|
@ -488,7 +488,7 @@ SELECT * FROM print_extension_changes();
|
||||||
| table cstore.cstore_data_files
|
| table cstore.cstore_data_files
|
||||||
| table cstore.cstore_skipnodes
|
| table cstore.cstore_skipnodes
|
||||||
| table cstore.cstore_stripes
|
| table cstore.cstore_stripes
|
||||||
| view cstore.cstore_options
|
| view cstore.columnar_options
|
||||||
(12 rows)
|
(12 rows)
|
||||||
|
|
||||||
DROP TABLE prev_objects, extension_diff;
|
DROP TABLE prev_objects, extension_diff;
|
||||||
|
|
|
@ -16,7 +16,7 @@ WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
description
|
description
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
access method cstore_tableam
|
access method columnar
|
||||||
event trigger citus_cascade_to_partition
|
event trigger citus_cascade_to_partition
|
||||||
event trigger cstore_ddl_event_end
|
event trigger cstore_ddl_event_end
|
||||||
foreign-data wrapper cstore_fdw
|
foreign-data wrapper cstore_fdw
|
||||||
|
@ -85,7 +85,7 @@ ORDER BY 1;
|
||||||
function cstore.cstore_ddl_event_end_trigger()
|
function cstore.cstore_ddl_event_end_trigger()
|
||||||
function cstore.cstore_fdw_handler()
|
function cstore.cstore_fdw_handler()
|
||||||
function cstore.cstore_fdw_validator(text[],oid)
|
function cstore.cstore_fdw_validator(text[],oid)
|
||||||
function cstore.cstore_tableam_handler(internal)
|
function cstore.columnar_handler(internal)
|
||||||
function cstore_table_size(regclass)
|
function cstore_table_size(regclass)
|
||||||
function distributed_tables_colocated(regclass,regclass)
|
function distributed_tables_colocated(regclass,regclass)
|
||||||
function dump_global_wait_edges()
|
function dump_global_wait_edges()
|
||||||
|
@ -221,7 +221,7 @@ ORDER BY 1;
|
||||||
view citus_shards_on_worker
|
view citus_shards_on_worker
|
||||||
view citus_stat_statements
|
view citus_stat_statements
|
||||||
view citus_worker_stat_activity
|
view citus_worker_stat_activity
|
||||||
view cstore.cstore_options
|
view cstore.columnar_options
|
||||||
view pg_dist_shard_placement
|
view pg_dist_shard_placement
|
||||||
(207 rows)
|
(207 rows)
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ ORDER BY 1;
|
||||||
view citus_shards_on_worker
|
view citus_shards_on_worker
|
||||||
view citus_stat_statements
|
view citus_stat_statements
|
||||||
view citus_worker_stat_activity
|
view citus_worker_stat_activity
|
||||||
view cstore.cstore_options
|
view cstore.columnar_options
|
||||||
view pg_dist_shard_placement
|
view pg_dist_shard_placement
|
||||||
(203 rows)
|
(203 rows)
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ $$ LANGUAGE PLPGSQL;
|
||||||
set cstore.stripe_row_count = 2000;
|
set cstore.stripe_row_count = 2000;
|
||||||
set cstore.block_row_count = 1000;
|
set cstore.block_row_count = 1000;
|
||||||
CREATE TABLE test_block_filtering (a int)
|
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;
|
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
|
-- Verify that we are fine with collations which use a different alphabet order
|
||||||
CREATE TABLE collation_block_filtering_test(A text collate "da_DK")
|
CREATE TABLE collation_block_filtering_test(A text collate "da_DK")
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
COPY collation_block_filtering_test FROM STDIN;
|
COPY collation_block_filtering_test FROM STDIN;
|
||||||
A
|
A
|
||||||
Å
|
Å
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
--
|
--
|
||||||
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
||||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
|
|
||||||
-- load table data from file
|
-- load table data from file
|
||||||
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
-- Create uncompressed table
|
-- Create uncompressed table
|
||||||
CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
|
CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
|
||||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
|
|
||||||
|
|
||||||
-- Create compressed table with automatically determined file path
|
-- Create compressed table with automatically determined file path
|
||||||
-- COMPRESSED
|
-- COMPRESSED
|
||||||
CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
|
CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
|
||||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
|
|
||||||
-- Test that querying an empty table works
|
-- Test that querying an empty table works
|
||||||
ANALYZE contestant;
|
ANALYZE contestant;
|
||||||
|
|
|
@ -11,7 +11,7 @@ SET intervalstyle TO 'POSTGRES_VERBOSE';
|
||||||
|
|
||||||
-- Test array types
|
-- Test array types
|
||||||
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
|
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;
|
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
|
-- Test date/time types
|
||||||
CREATE TABLE test_datetime_types (timestamp timestamp,
|
CREATE TABLE test_datetime_types (timestamp timestamp,
|
||||||
timestamp_with_timezone timestamp with time zone, date date, time time,
|
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;
|
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 TYPE composite_type AS (a int, b text);
|
||||||
|
|
||||||
CREATE TABLE test_enum_and_composite_types (enum enum_type,
|
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
|
COPY test_enum_and_composite_types FROM
|
||||||
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV;
|
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV;
|
||||||
|
@ -43,7 +43,7 @@ SELECT * FROM test_enum_and_composite_types;
|
||||||
|
|
||||||
-- Test range types
|
-- Test range types
|
||||||
CREATE TABLE test_range_types (int4range int4range, int8range int8range,
|
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;
|
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
|
-- Test other types
|
||||||
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
|
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;
|
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
|
-- Test null values
|
||||||
CREATE TABLE test_null_values (a int, b int[], c composite_type)
|
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;
|
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
|
-- Test column list
|
||||||
CREATE TABLE famous_constants (id int, name text, value real)
|
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 (value, name, id) FROM STDIN WITH CSV;
|
||||||
3.141,pi,1
|
3.141,pi,1
|
||||||
2.718,e,2
|
2.718,e,2
|
||||||
|
|
|
@ -28,7 +28,7 @@ $$ LANGUAGE PLPGSQL;
|
||||||
set cstore.stripe_row_count = 2000;
|
set cstore.stripe_row_count = 2000;
|
||||||
set cstore.block_row_count = 1000;
|
set cstore.block_row_count = 1000;
|
||||||
CREATE TABLE test_block_filtering (a int)
|
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;
|
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
|
-- Verify that filtered_row_count is less than 1000 for the following queries
|
||||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering');
|
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;
|
set cstore.block_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_block_filtering_test(A text collate "da_DK")
|
CREATE TABLE collation_block_filtering_test(A text collate "da_DK")
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
COPY collation_block_filtering_test FROM STDIN;
|
COPY collation_block_filtering_test FROM STDIN;
|
||||||
SELECT * FROM collation_block_filtering_test WHERE A > 'B';
|
SELECT * FROM collation_block_filtering_test WHERE A > 'B';
|
||||||
a
|
a
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
--
|
--
|
||||||
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
||||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
-- load table data from file
|
-- load table data from file
|
||||||
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
||||||
-- export using COPY table TO ...
|
-- export using COPY table TO ...
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
-- Create uncompressed table
|
-- Create uncompressed table
|
||||||
CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
|
CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
|
||||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
-- Create compressed table with automatically determined file path
|
-- Create compressed table with automatically determined file path
|
||||||
-- COMPRESSED
|
-- COMPRESSED
|
||||||
CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
|
CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
|
||||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
-- Test that querying an empty table works
|
-- Test that querying an empty table works
|
||||||
ANALYZE contestant;
|
ANALYZE contestant;
|
||||||
SELECT count(*) FROM contestant;
|
SELECT count(*) FROM contestant;
|
||||||
|
|
|
@ -7,7 +7,7 @@ SET timezone to 'GMT';
|
||||||
SET intervalstyle TO 'POSTGRES_VERBOSE';
|
SET intervalstyle TO 'POSTGRES_VERBOSE';
|
||||||
-- Test array types
|
-- Test array types
|
||||||
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
|
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;
|
COPY test_array_types FROM '@abs_srcdir@/data/array_types.csv' WITH CSV;
|
||||||
SELECT * FROM test_array_types;
|
SELECT * FROM test_array_types;
|
||||||
int_array | bigint_array | text_array
|
int_array | bigint_array | text_array
|
||||||
|
@ -20,7 +20,7 @@ SELECT * FROM test_array_types;
|
||||||
-- Test date/time types
|
-- Test date/time types
|
||||||
CREATE TABLE test_datetime_types (timestamp timestamp,
|
CREATE TABLE test_datetime_types (timestamp timestamp,
|
||||||
timestamp_with_timezone timestamp with time zone, date date, time time,
|
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;
|
COPY test_datetime_types FROM '@abs_srcdir@/data/datetime_types.csv' WITH CSV;
|
||||||
SELECT * FROM test_datetime_types;
|
SELECT * FROM test_datetime_types;
|
||||||
timestamp | timestamp_with_timezone | date | time | interval
|
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 enum_type AS ENUM ('a', 'b', 'c');
|
||||||
CREATE TYPE composite_type AS (a int, b text);
|
CREATE TYPE composite_type AS (a int, b text);
|
||||||
CREATE TABLE test_enum_and_composite_types (enum enum_type,
|
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
|
COPY test_enum_and_composite_types FROM
|
||||||
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV;
|
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV;
|
||||||
SELECT * FROM test_enum_and_composite_types;
|
SELECT * FROM test_enum_and_composite_types;
|
||||||
|
@ -45,7 +45,7 @@ SELECT * FROM test_enum_and_composite_types;
|
||||||
|
|
||||||
-- Test range types
|
-- Test range types
|
||||||
CREATE TABLE test_range_types (int4range int4range, int8range int8range,
|
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;
|
COPY test_range_types FROM '@abs_srcdir@/data/range_types.csv' WITH CSV;
|
||||||
SELECT * FROM test_range_types;
|
SELECT * FROM test_range_types;
|
||||||
int4range | int8range | numrange | tsrange
|
int4range | int8range | numrange | tsrange
|
||||||
|
@ -56,7 +56,7 @@ SELECT * FROM test_range_types;
|
||||||
|
|
||||||
-- Test other types
|
-- Test other types
|
||||||
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
|
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;
|
COPY test_other_types FROM '@abs_srcdir@/data/other_types.csv' WITH CSV;
|
||||||
SELECT * FROM test_other_types;
|
SELECT * FROM test_other_types;
|
||||||
bool | bytea | money | inet | bitstring | uuid | json
|
bool | bytea | money | inet | bitstring | uuid | json
|
||||||
|
@ -67,7 +67,7 @@ SELECT * FROM test_other_types;
|
||||||
|
|
||||||
-- Test null values
|
-- Test null values
|
||||||
CREATE TABLE test_null_values (a int, b int[], c composite_type)
|
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;
|
COPY test_null_values FROM '@abs_srcdir@/data/null_values.csv' WITH CSV;
|
||||||
SELECT * FROM test_null_values;
|
SELECT * FROM test_null_values;
|
||||||
a | b | c
|
a | b | c
|
||||||
|
|
|
@ -23,7 +23,7 @@ COPY contestant_compressed FROM PROGRAM 'cat @abs_srcdir@/data/contestants.2.csv
|
||||||
set cstore.compression to default;
|
set cstore.compression to default;
|
||||||
-- Test column list
|
-- Test column list
|
||||||
CREATE TABLE famous_constants (id int, name text, value real)
|
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 (value, name, id) FROM STDIN WITH CSV;
|
||||||
COPY famous_constants (name, value) FROM STDIN WITH CSV;
|
COPY famous_constants (name, value) FROM STDIN WITH CSV;
|
||||||
SELECT * FROM famous_constants ORDER BY id, name;
|
SELECT * FROM famous_constants ORDER BY id, name;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
setup
|
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
|
teardown
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
setup
|
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
|
teardown
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- Testing ALTER TABLE on cstore_fdw tables.
|
-- 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
|
WITH sample_data AS (VALUES
|
||||||
(1, 2, 3),
|
(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 a cstore_fdw table under a schema and drop it.
|
||||||
CREATE SCHEMA test_schema;
|
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
|
SELECT count(*) AS cstore_data_files_before_drop FROM cstore.cstore_data_files \gset
|
||||||
DROP SCHEMA test_schema CASCADE;
|
DROP SCHEMA test_schema CASCADE;
|
||||||
|
@ -39,7 +39,7 @@ CREATE DATABASE db_to_drop;
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
|
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;
|
DROP EXTENSION citus CASCADE;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ DROP EXTENSION citus CASCADE;
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
|
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
|
\c :datname
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
-- Test utility functions for cstore_fdw tables.
|
-- Test utility functions for cstore_fdw tables.
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE empty_table (a int) USING cstore_tableam;
|
CREATE TABLE empty_table (a int) USING columnar;
|
||||||
CREATE TABLE table_with_data (a int) USING cstore_tableam;
|
CREATE TABLE table_with_data (a int) USING columnar;
|
||||||
CREATE TABLE non_cstore_table (a int);
|
CREATE TABLE non_cstore_table (a int);
|
||||||
|
|
||||||
COPY table_with_data FROM STDIN;
|
COPY table_with_data FROM STDIN;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- Testing insert on cstore_fdw tables.
|
-- 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
|
-- test single row inserts fail
|
||||||
select count(*) from test_insert_command;
|
select count(*) from test_insert_command;
|
||||||
|
@ -38,7 +38,7 @@ SELECT int_val, md5(text_val) AS hash
|
||||||
FROM test_long_text;
|
FROM test_long_text;
|
||||||
|
|
||||||
CREATE TABLE test_cstore_long_text(int_val int, text_val text)
|
CREATE TABLE test_cstore_long_text(int_val int, text_val text)
|
||||||
USING cstore_tableam;
|
USING columnar;
|
||||||
|
|
||||||
-- store long text in cstore table
|
-- store long text in cstore table
|
||||||
INSERT INTO test_cstore_long_text SELECT * FROM test_long_text;
|
INSERT INTO test_cstore_long_text SELECT * FROM test_long_text;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
CREATE SCHEMA am_cstore_join;
|
CREATE SCHEMA am_cstore_join;
|
||||||
SET search_path TO 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;
|
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;
|
INSERT INTO things SELECT a, a % 30, 'thing' || a FROM generate_series(1,300) AS a;
|
||||||
|
|
||||||
-- force the nested loop to rescan the table
|
-- force the nested loop to rescan the table
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
-- Testing we materialized views properly
|
-- 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;
|
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 a, sum(b), count(*) FROM t GROUP BY a;
|
||||||
|
|
||||||
SELECT * FROM t_view a ORDER 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;
|
SELECT to_json(v) FROM contestant v ORDER BY rating LIMIT 1;
|
||||||
|
|
||||||
-- Test variables used in expressions
|
-- Test variables used in expressions
|
||||||
CREATE TABLE union_first (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 cstore_tableam;
|
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_first SELECT a, a FROM generate_series(1, 5) a;
|
||||||
INSERT INTO union_second SELECT a, a FROM generate_series(11, 15) 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 t1(a int, b int) USING columnar;
|
||||||
CREATE TABLE t2(a int, b int) USING cstore_tableam;
|
CREATE TABLE t2(a int, b int) USING columnar;
|
||||||
|
|
||||||
CREATE FUNCTION f(x INT) RETURNS INT AS $$
|
CREATE FUNCTION f(x INT) RETURNS INT AS $$
|
||||||
INSERT INTO t1 VALUES(x, x * 2) RETURNING b - 1;
|
INSERT INTO t1 VALUES(x, x * 2) RETURNING b - 1;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- Testing we handle rollbacks properly
|
-- 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;
|
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;
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
CREATE SCHEMA am_tableoptions;
|
CREATE SCHEMA am_tableoptions;
|
||||||
SET search_path TO 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);
|
INSERT INTO table_options SELECT generate_series(1,100);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- test changing the compression
|
-- test changing the compression
|
||||||
SELECT alter_cstore_table_set('table_options', compression => 'pglz');
|
SELECT alter_cstore_table_set('table_options', compression => 'pglz');
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- test changing the block_row_count
|
-- test changing the block_row_count
|
||||||
SELECT alter_cstore_table_set('table_options', block_row_count => 10);
|
SELECT alter_cstore_table_set('table_options', block_row_count => 10);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- test changing the block_row_count
|
-- test changing the block_row_count
|
||||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
|
SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.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.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- set all settings at the same time
|
-- set all settings at the same time
|
||||||
SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.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
|
||||||
|
@ -50,24 +50,24 @@ SET cstore.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.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', block_row_count => true);
|
SELECT alter_cstore_table_reset('table_options', block_row_count => true);
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
|
SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset('table_options', compression => true);
|
SELECT alter_cstore_table_reset('table_options', compression => true);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.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
|
||||||
|
@ -76,7 +76,7 @@ SET cstore.stripe_row_count TO 100000;
|
||||||
SET cstore.compression TO 'none';
|
SET cstore.compression TO 'none';
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
SELECT alter_cstore_table_reset(
|
SELECT alter_cstore_table_reset(
|
||||||
|
@ -86,7 +86,7 @@ SELECT alter_cstore_table_reset(
|
||||||
compression => true);
|
compression => true);
|
||||||
|
|
||||||
-- show table_options settings
|
-- show table_options settings
|
||||||
SELECT * FROM cstore.cstore_options
|
SELECT * FROM cstore.columnar_options
|
||||||
WHERE regclass = 'table_options'::regclass;
|
WHERE regclass = 'table_options'::regclass;
|
||||||
|
|
||||||
-- verify edge cases
|
-- verify edge cases
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- Testing we handle transactions properly
|
-- 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;
|
INSERT INTO t SELECT i, 2 * i FROM generate_series(1, 3) i;
|
||||||
SELECT * FROM t ORDER BY a;
|
SELECT * FROM t ORDER BY a;
|
||||||
|
|
|
@ -40,7 +40,7 @@ BEGIN
|
||||||
END;
|
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
|
create trigger tr_before_stmt before insert on test_tr
|
||||||
for each statement execute procedure trs_before();
|
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;
|
SELECT * FROM test_tr ORDER BY i;
|
||||||
|
|
||||||
drop table test_tr;
|
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
|
-- we should be able to clean-up and continue gracefully if we
|
||||||
-- error out in AFTER STATEMENT triggers.
|
-- error out in AFTER STATEMENT triggers.
|
||||||
|
@ -102,13 +102,13 @@ create table events(
|
||||||
|
|
||||||
create table events_p2020_11_04_102965
|
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')
|
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(
|
create table events_trigger_target(
|
||||||
user_id bigint,
|
user_id bigint,
|
||||||
avg float,
|
avg float,
|
||||||
__count__ bigint
|
__count__ bigint
|
||||||
) USING cstore_tableam;
|
) USING columnar;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION user_value_by_day()
|
CREATE OR REPLACE FUNCTION user_value_by_day()
|
||||||
RETURNS trigger
|
RETURNS trigger
|
||||||
|
|
|
@ -7,10 +7,10 @@ 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 cstore_fdw table, fill with some data --
|
||||||
CREATE TABLE cstore_truncate_test (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 cstore_tableam;
|
CREATE TABLE cstore_truncate_test_second (a int, b int) USING columnar;
|
||||||
-- COMPRESSED
|
-- 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);
|
CREATE TABLE cstore_truncate_test_regular (a int, b int);
|
||||||
|
|
||||||
SELECT count(*) AS cstore_data_files_before_truncate FROM cstore.cstore_data_files \gset
|
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
|
-- test if truncation in the same transaction that created the table works properly
|
||||||
BEGIN;
|
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);
|
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(1, 100);
|
||||||
TRUNCATE cstore_same_transaction_truncate;
|
TRUNCATE cstore_same_transaction_truncate;
|
||||||
INSERT INTO cstore_same_transaction_truncate SELECT * FROM generate_series(20, 23);
|
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
|
-- test truncate with schema
|
||||||
CREATE SCHEMA truncate_schema;
|
CREATE SCHEMA truncate_schema;
|
||||||
-- COMPRESSED
|
-- 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';
|
set cstore.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 cstore.compression to default;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
SELECT count(*) AS columnar_table_count FROM cstore.cstore_data_files \gset
|
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';
|
SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.relfilenode AND b.relname='t';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue