カラムストアインデックス

インメモリー列ストアがカラムストア構造

未対応の模様

 

cstore_fdw

http://tech.gmo-media.jp/post/147773750479/cstore-fdw-review


--前提
(9.6)でソースコンパイル

yum -y install git
yum -y install protobuf-c-devel


cd /usr/local/src
git clone https://github.com/citusdata/cstore_fdw.git
cd /usr/local/src/cstore_fdw
PATH=/usr/local/pgsql/bin/:$PATH make
sudo PATH=/usr/local/pgsql/bin/:$PATH make install

su - postgres
vim $PGDATA/postgresql.conf

shared_preload_libraries = 'cstore_fdw'

pg_ctl reload
psql
create database test;
create role user11 with superuser login encrypted password 'user11';
\c test

CREATE EXTENSION cstore_fdw;
\dx

CREATE SERVER cstore_server FOREIGN DATA WRAPPER cstore_fdw;

GRANT USAGE ON FOREIGN SERVER cstore_server TO user11;

\c test user11
CREATE FOREIGN TABLE tab11 (
col1 int NOT NULL
)
SERVER cstore_server
OPTIONS(compression 'pglz');

\det
\det+

https://tech.at-iroha.jp/?p=626


--クラスター化カラムストアインデックス
--(2014)で更新可能で登場
--メモリ最適化テーブルで作成可

create table tab4(col1 int);
create clustered columnstore index ind41 on tab4;
go


--非クラスター化カラムストアインデックス
--(2012)で登場。ただし読み取り専用
--(2016)で更新可能に変更
--メモリ最適化テーブルで作成不可

create table tab5(col1 int);
create nonclustered columnstore index ind51 on tab5(col1);
go