NTT Data ãéçºãã(ã¨ããããSenna ã® PostgreSQL ãã¤ã³ãã£ã³ã°ãä½ã£ã) Ludia ã使ã£ã¦ã¿ãã
# 以åãpg_senna ã試ãããã¨ããããæå¾
大ã
ã¤ã³ã¹ãã¼ã«ã¯ ããã¥ã¡ã³ãéãã«åé¡ãªãå®äºã
ç°å¢ã¯
- Athlon64 3800+ (Dual Core)
- 1GB RAM
- Fedora Core 5
- PostgreSQL-8.1.4
ãããªã®ã§ã(MacOS X, PostgreSQL-8.1.4ã§ãã¡ããã¨åããã)
æå ã®ãPlagger ã§åã£ã¦ãããã£ã¼ããä¿åãã¦ãããã¼ãã«ã« INDEX ãä½ã£ã¦æ¤ç´¢ãã¦ã¿ãã
# SELECT count(*) FROM entry; count ------- 64445 # SELECT sum(octet_length(body)) FROM entry; sum ---------- 69037755 # CREATE INDEX entry_ftidx ON entry USING fulltext(body); CREATE INDEX Time: 65367.833 ms
6ä¸4å件ã70MBã»ã©ã®ãµã¤ãºãindex ä½æ㯠1ms/row ç¨åº¦ã¨é«éã
# SELECT substring(title,1,30), pgs2getscore(entry.ctid, 'entry_ftidx') FROM entry WHERE body @@ 'Plagger'; substring | pgs2getscore --------------------------------------------------------------+-------------- akaihoã®æ¥è¨ | 235 Plaggerã§åºåã寿å¸ã«å¯¾å¿ãã¾ãã | 185 Catalyst::Plugin::Plagger ã使ã£ã¦ | 110 Googleã§ãã¯ãã¸ã£ããã¨æ¤ç´¢ããã¨ãã¶ãå±ãããã«ãã | 100 (ç¥) (469 rows) Time: 3.682 ms
ãããã«éããæ®éã« LIKE ãæ£è¦è¡¨ç¾ã§é¨åä¸è´æ¤ç´¢ãããã¨ã1200 ms ç¨åº¦ã
# ã¾ãã70MBã1.2ç§ã§ãã¿ãªãã§ãããã¨ããæè¿ã®æ©æ¢°ãåååãã¨ã¯æãã
æ¤ç´¢ã«ã¯ senna ã®æ¤ç´¢å¼æ¸å¼ã使ãããhttp://qwik.jp/senna/query.html
ããã«ã(å½ç¶ã¨ããã) ä»ã®ã«ã©ã ã§æ¡ä»¶ãä»ãã¦çµã£ãããã§ããã
# SELECT * FROM entry WHERE body @@ 'Plagger +LDR' AND link !~ '\.internal';
ããã¯ç´ æ´ããããDBä¸ã®ãã¼ã¿ã«å¯¾ããå ¨ææ¤ç´¢ã¸ã®æ·å± ãããã£ã¨ä¸ãã£ãæãã
ããã¯ããã¨ãludia ã® README ã«ããä¾ãããã®å£ºã¯ãããã®ã ãâ¦â¦ã£ã¦ããã»ã¯ãã§ããã
SELECT * FROM table1 WHERE col1 @@ 'ãã'; col1 | col2 --------------------------+-------------------- ãããããããããã®ãã¡ | ãã®å£ºã¯ãããã®ã ããããçã¾ããæ¡å¤ªé | ãã®å£·ã¯ãããã®ã (2 rows)