다음은 Mastering PostgreSQL 13 의 내용 중 index 부분의 일부를정리한 글입니다. 개인 복습용
SELECT to_tsvector('english', 'A car, I want a car. I would not even mind having many cars');
to_tsvector
---------------------------------------------------------------
'car':2,6,14 'even':10 'mani':13 'mind':11 'want':4 'would':8
more supported languages
select cfgname from pg_ts_config;
true
반환to_tsvector('english', 'wanted') @@ to_tsvector('english', 'want') -> true
ts_debug
SELECT * FROM ts_debug('english', 'go to www.cybertec-postgresql.com');
ts_stat
함수CREATE EXTENSION btree_gist;
CREATE TABLE t_reservation (
room int,
from_to tsrange,
EXCLUDE USING GiST (room with =,
from_to with &&)
);
INSERT INTO t_reservation VALUES (13, '["2017-01-01", "2017-03-03"]');
INSERT 0 1
INSERT INTO t_reservation VALUES (13, '["2017-02-02", "2017-08-14"]');
ERROR: conflicting key value violates exclusion constraint "t_reservation_room_from_to_excl"
DETAIL: Key (room, from_to)=(13, ["2017-02-02 00:00:00","2017-08-14 00:00:00"]) conflicts with existing key (room, from_to)=(13, ["2017-01-01 00:00:00","2017-03-03 00:00:00"]).