pgroonga.rab in rabbit-slide-kou-pgconf-asia-2016-2016.12.3.1 vs pgroonga.rab in rabbit-slide-kou-pgconf-asia-2016-2016.12.3.2
- old
+ new
@@ -20,13 +20,13 @@
Some my patches are merged\n
(('note:いくつかパッチがマージされている'))
= Patches\n(('note:パッチ'))
- * (('wait'))BUG #13840: pg_dump generates unloadable SQL\n
+ * (('wait'))#13840: pg_dump generates unloadable SQL\n
(('note:pg_dumpがリストアできないSQLを出力する'))
- * (('wait'))BUG #14160: DROP ACCESS METHOD IF EXISTS isn't impl.\n
+ * (('wait'))#14160: DROP ACCESS METHOD IF EXISTS isn't impl.\n
(('note:DROP ACCESS METHOD IF EXISTSが実装されていない'))
(('wait'))
(('tag:center'))
They are found while developing PGroonga\n
@@ -41,11 +41,11 @@
(('note:PGroonga側で回避するのではなく'))\n
(('note:関連プロジェクトの方で問題を直す'))
= PostgreSQL and FTS\n(('note:PostgreSQLと全文検索'))
- * PostgreSQL has out-of-the-box full text search feature\n
+ * PostgreSQL has built-in full text search feature\n
(('note:PostgreSQLには組込の全文検索機能がある'))\n
* (('wait'))It has some problems...\n
(('note:ただ、いくつか問題がある'))
* (('wait'))We fixed them by PGroonga\n
(('note:PGroongaを開発することでそれらの問題を修正した'))
@@ -240,11 +240,11 @@
(1) Split text to tokens\n
(('note:テキストをトークンに分割'))
* "cat"→"ca","at"
(2) ((*Search all tokens*))\n
(('note:すべてのトークンを検索'))
- * "ca" and "at" exist: Candidate!
+ * "ca" & "at" exist: Candidate!
(3) ((*Check appearance pos.*))\n
(('note:出現位置をチェック'))
* "ca" then "at": Found!
= N-gram and GIN: Create\n(('note:N-gramとGIN:作成'))
@@ -459,11 +459,11 @@
# src = images/index-creation-en.pdf
# relative_height = 100
= Performance: Wrap up\n(('note:性能:まとめ'))
- * Keep fast search with update\n
+ * Keep fast search w/ update\n
(('note:更新しながらでも高速検索を維持'))
* Support index only scan\n
(('note:インデックスオンリースキャンをサポート'))
* Direct Groonga search is more faster\n
(('note:Groonga直接検索はもっと速い'))
@@ -554,41 +554,72 @@
* Not only a text in a path\n
(('note:特定のパスのテキストだけではない'))\n
(('note:(GIN supports only this style)'))\n
(('note:(GINはこのやり方だけサポート)'))
-= JSON: FTS\n(('note:JSON:全文検索'))
+= JSON: FTS: Data\n(('note:JSON:全文検索:Data'))
# coderay sql
+ CREATE TABLE logs (
+ record jsonb
+ );
INSERT INTO logs (record)
VALUES ('{"host": "app1"}'),
('{"message": "app is down"}');
+
+= JSON: FTS: Index\n(('note:JSON:全文検索:インデックス'))
+
+ # coderay sql
+ CREATE INDEX message_index ON logs
+ USING GIN
+ ((record->>'message') gin_trgm_ops);
+ -- {"message": "HERE IS ONLY SEARCHABLE"}
+ CREATE INDEX record_index ON logs
+ USING pgroonga (record);
+ -- All string values are searchable
+
+= JSON: FTS: GIN\n(('note:JSON:全文検索:GIN'))
+
+ # coderay sql
SELECT * FROM logs
- WHERE record @@ 'string @@ "app"'
- -- record
- -- --------------------------
- -- {"host": "app1"}
- -- {"message": "app is down"}
+ WHERE record->>'message' LIKE '%app%';
+ -- ↑ {"host": "app1"} isn't target
+ -- record
+ -- ----------------------------
+ -- {"message": "app is down"}
+ -- (1 row)
+= JSON: FTS: PGroonga\n(('note:JSON:全文検索:PGroonga'))
+
+ # coderay sql
+ SELECT * FROM logs
+ WHERE record @@ 'string @ "app"';
+ -- ↑ All string values are target
+ -- record
+ -- ----------------------------
+ -- {"host": "app1"}
+ -- {"message": "app is down"}
+ -- (2 rows)
+
= JSON: Wrap up\n(('note:JSON:まとめ'))
* Support full text search against all texts in JSON\n
(('note:JSON内の全テキスト対象の全文検索をサポート'))
= Replication\n(('note:レプリケーション'))
- * Support with PostgreSQL 9.6!\n
+ * Support with PG 9.6!\n
(('note:PostgreSQL 9.6で使う場合はサポート!'))
* PostgreSQL 9.6 ships "generic WAL"\n
(('note:PostgreSQL 9.6で「generic WAL」機能が追加'))
* Third party index can support WAL generation\n
(('note:サードパーティーのインデックスもWALを生成できる'))
= Implementation\n(('note:実装'))
(1) Master: Encode action logs as MessagePack\n
- (('note:マスター:アクションログをMessagePackでエンコード'))
+ (('note:マスター:アクションログをMessagePack形式に変換'))
(2) Master: Write the action logs to WAL\n
(('note:マスター:アクションログをWALに書き込み'))
(3) Slaves: Read the action logs and apply them\n
(('note:スレーブ:アクションログを読み込んで適用'))
@@ -644,10 +675,10 @@
* It's useful to stop applying action logs when WAL is applied partially on slaves\n
(('note:スレーブでWALが途中までしか書き込まれていないときにアクションログの適用を中断できるので便利'))
= Replication: Wrap up\n(('note:レプリケーション:まとめ'))
- * Support with PostgreSQL 9.6!\n
+ * Support with PG 9.6!\n
(('note:PostgreSQL 9.6で使う場合はサポート!'))
* Concept: Action logs on WAL\n
(('note:コンセプト:WAL上にアクションログを書く'))
* It'll be an useful pattern for out of PostgreSQL storage index\n
(('note:PostgreSQL管理外のストレージを使うインデックスではこのパターンが使えるはず'))