Skip to content

Instantly share code, notes, and snippets.

@fj fj/postgres-10.sql
Created Oct 5, 2017

Embed
What would you like to do?
-- full-text search in JSON/JSONB columns
CREATE INDEX transactions_fts ON transactions
USING gin (( to_tsvector('english', transactions) ))
-- parallelism now supported or improved in:
-- * bitmap heap scans
-- * merge joins
-- * btree index scans
-- partitioning
CREATE TABLE integers (x INTEGER) PARTITION BY RANGE (x);
CREATE TABLE naturals PARTITION OF integers FOR VALUES FROM (0) TO (UNBOUNDED);
INSERT INTO integers VALUES (-500), (-123), (0), (123), (456);
SELECT * FROM naturals;
-- x
-- ----
-- 0
-- 123
-- 456
-- logical replication
-- on cluster one
CREATE PUBLICATION channel FOR TABLE jobs;
-- on cluster two
CREATE SUBSCRIPTION worker CONNECTION 'port=5432 dbname=worker_db' PUBLICATION channel;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.