{"id":4682,"date":"2017-01-27T12:04:21","date_gmt":"2017-01-27T03:04:21","guid":{"rendered":"http:\/\/www.lancard.com\/blog\/?p=4682"},"modified":"2025-03-12T11:26:49","modified_gmt":"2025-03-12T02:26:49","slug":"centos7%e3%81%aepostgresql9-2%e3%81%a7%e5%85%a8%e6%96%87%e6%a4%9c%e7%b4%a2","status":"publish","type":"post","link":"https:\/\/www.lancard.com\/blog\/2017\/01\/27\/centos7%e3%81%aepostgresql9-2%e3%81%a7%e5%85%a8%e6%96%87%e6%a4%9c%e7%b4%a2\/","title":{"rendered":"CentOS7\u306ePostgreSQL9.2\u3067\u5168\u6587\u691c\u7d22"},"content":{"rendered":"<p>PostgreSQL\u306e\u5168\u6587\u691c\u7d22\u3067Ludia, textsearch_senna\u3092\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u30019.2\u3067\u306f\u3069\u3061\u3089\u3082\u4f7f\u3048\u306a\u3044\u306e\u3067\u3001\u4ee3\u66ff\u3068\u306a\u308a\u305d\u3046\u306a\u3082\u306e\u3092\u63a2\u3057\u305f\u7d50\u679c\u3001pg_trgm, pg_bigm, textsearch_ja\u306e\u4e09\u3064\u304c\u4f7f\u3048\u305d\u3046\u3067\u3057\u305f\u3002<br \/>\n\u305f\u3060pg_trgm\u306f\u65e5\u672c\u8a9e\u3092\u4f7f\u3046\u306b\u306f\u30bd\u30fc\u30b9\u304b\u3089\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u304c\u5fc5\u8981\u3067\u3001\u3057\u304b\u3082\u4e8c\u6587\u5b57\u4ee5\u4e0b\u306f\u4f7f\u3048\u306a\u3044\u306e\u3067\u30d1\u30b9\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<h1>textsearch_ja<\/h1>\n<p>textsearch_ja\u306ftsvector\u306e\u62e1\u5f35\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305atextsearch_ja\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\ngcc-c++\u3068\u304b\u304c\u5fc5\u8981\u3089\u3057\u3044\u306e\u3067\u4e8b\u524d\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305a\u306fmecab\u3002<br \/>\nhttp:\/\/taku910.github.io\/mecab\/#download<br \/>\nmecab\u672c\u4f53\u3068ipa\u8f9e\u66f8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3002<br \/>\nPostgreSQL\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u306f\u30c7\u30d5\u30a9\u30eb\u30c8UTF-8\u306a\u306e\u3067configure\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u306f\u3001<\/p>\n<pre lang=\"bash\">\n--with-charset=utf8\n<\/pre>\n<p>\u3092\u3069\u3061\u3089\u3082\u8ffd\u52a0\u3057\u306a\u3044\u3068\u99c4\u76ee\u3067\u3057\u305f\u3002<br \/>\n\u305d\u306e\u5f8c\u3001\/etc\/ld.so.conf.d\/mecab.conf\u3092\u4f5c\u6210\u3057\u3066\u4ee5\u4e0b\u4e00\u884c\u3092\u8ffd\u52a0\u3002<\/p>\n<pre lang=\"bash\">\n\/usr\/local\/lib\n<\/pre>\n<p>\u3053\u306e\u5f8cldconfig\u3092\u5b9f\u65bd\u3057\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306btextsearch_ja\u672c\u4f53<br \/>\nhttp:\/\/textsearch-ja.projects.pgfoundry.org\/textsearch_ja.html<\/p>\n<pre lang=\"bash\">\ntar xzf textsearch_ja-9.0.0.tar.gz\ncd textsearch_ja-9.0.0\/\nmake USE_PGXS=1\nmake USE_PGXS=1 install\n<\/pre>\n<p>\/usr\/share\/pgsql\/contrib\/textsearch_ja.sql \u306f\u305d\u306e\u307e\u307e\u5b9f\u884c\u3059\u308b\u3068\u99c4\u76ee\u3067\u3001&#8217;C&#8217;\u3092\u5c0f\u6587\u5b57\u306b\u76f4\u3059\u304b\u3001\u30af\u30a9\u30fc\u30c8\u3092\u5916\u3059\u5fc5\u8981\u304c\u6709\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre lang=\"bash\">\npsql [database] -f \/usr\/share\/pgsql\/contrib\/textsearch_ja.sql\npsql [database]\n CREATE INDEX test_tb_content ON test_tb USING gin(to_tsvector('japanese', content));\n<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c<\/p>\n<pre lang=\"sql\">\nEXPLAIN SELECT * FROM test_tb WHERE to_tsvector('japanese', content) @@ to_tsquery('japanese', '\u732b');\n                                       QUERY PLAN                                       \n----------------------------------------------------------------------------------------\n Bitmap Heap Scan on test_tb  (cost=19.65..1470.66 rows=471 width=529)\n   Recheck Cond: (to_tsvector('japanese'::regconfig, content) @@ '''\u732b'''::tsquery)\n   ->  Bitmap Index Scan on test_tb_content  (cost=0.00..19.53 rows=471 width=0)\n         Index Cond: (to_tsvector('japanese'::regconfig, content) @@ '''\u732b'''::tsquery)\n(4 \u884c)\n<\/pre>\n<h1>pg_bigm<\/h1>\n<p>pg_bigm\u306fpg_trgm\u306e\u62e1\u5f35\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>http:\/\/pgbigm.osdn.jp\/pg_bigm-1-2.html#install<\/p>\n<p>PostgreSQL\u306b\u3064\u3044\u3066\u306frpm\u7248\u3092\u4f7f\u3046\u306e\u3067\u7701\u7565\u3002<br \/>\n\u307e\u305f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306fpostgresql-devel\u304c\u5fc5\u8981\u306a\u306e\u3067\u4e8b\u524d\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>CentOS6\u7528\u306erpm\u304c\u6709\u308a\u307e\u3057\u305f\u304c\u3001CentOS7\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306epostgresql\u3067\u306f\u4f7f\u3048\u306a\u304b\u3063\u305f\u306e\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066make\u3057\u307e\u3059\u3002<br \/>\npg_config\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u30d1\u30b9\u304c\u901a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u5165\u308c\u305a\u306b\u5b9f\u884c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre lang=\"bash\">\ntar xzf pg_bigm-1.2-20161011.tar.gz\ncd pg_bigm-1.2-20161011\/\nmake USE_PGXS=1\nmake USE_PGXS=1 install\n<\/pre>\n<p>\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3054\u3068\u306bextension\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre lang=\"sql\">\nsu - postgres\npsql [database]\nCREATE EXTENSION pg_bigm;\n<\/pre>\n<p>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u8ffd\u52a0\u3057\u3066\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre lang=\"sql\">\nCREATE INDEX test_tb_content_bigm ON test_tb USING gin (content gin_bigm_ops);\nEXPLAIN SELECT * FROM test_tb WHERE content LIKE '%\u732b%';\n                                      QUERY PLAN                                       \n---------------------------------------------------------------------------------------\n Bitmap Heap Scan on test_tb  (cost=40.06..71.29 rows=8 width=529)\n   Recheck Cond: (content ~~ '%\u732b%'::text)\n   ->  Bitmap Index Scan on test_tb_content_bigm  (cost=0.00..40.06 rows=8 width=0)\n         Index Cond: (content ~~ '%\u732b%'::text)\n(4 \u884c)\n<\/pre>\n<p>\u5358\u7d14\u306a\u7d50\u679c\u3068\u3057\u3066\u306f\u3001pg_bigm\u306e\u65b9\u304c\u6709\u5229\u306a\u306e\u304b\u306a\u3068\u3044\u3063\u305f\u611f\u3058\u3067\u3057\u305f\u3002<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4682&#038;t=CentOS7%E3%81%AEPostgreSQL9.2%E3%81%A7%E5%85%A8%E6%96%87%E6%A4%9C%E7%B4%A2&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4682&#038;p&#091;images&#093;&#091;0&#093;=&#038;p&#091;title&#093;=CentOS7%E3%81%AEPostgreSQL9.2%E3%81%A7%E5%85%A8%E6%96%87%E6%A4%9C%E7%B4%A2\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/facebook.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"http:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4682&#038;text=CentOS7%E3%81%AEPostgreSQL9.2%E3%81%A7%E5%85%A8%E6%96%87%E6%A4%9C%E7%B4%A2\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4682&#038;title=CentOS7%E3%81%AEPostgreSQL9.2%E3%81%A7%E5%85%A8%E6%96%87%E6%A4%9C%E7%B4%A2\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/linkedin.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-tumblr nolightbox\" data-provider=\"tumblr\" target=\"_blank\" rel=\"nofollow\" title=\"Share on tumblr\" href=\"https:\/\/tumblr.com\/share?s=&#038;v=3&#038;t=CentOS7%E3%81%AEPostgreSQL9.2%E3%81%A7%E5%85%A8%E6%96%87%E6%A4%9C%E7%B4%A2&#038;u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4682\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"tumblr\" title=\"Share on tumblr\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/tumblr.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=CentOS7%E3%81%AEPostgreSQL9.2%E3%81%A7%E5%85%A8%E6%96%87%E6%A4%9C%E7%B4%A2&#038;body=%E3%82%B7%E3%82%A7%E3%82%A2%E3%81%99%E3%82%8B%EF%BC%9A:%20https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4682\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/mail.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>PostgreSQL\u306e\u5168\u6587\u691c\u7d22\u3067Ludia, textsearch_senna\u3092\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u30019.2\u3067\u306f\u3069\u3061\u3089\u3082\u4f7f\u3048\u306a\u3044\u306e\u3067\u3001\u4ee3\u66ff\u3068\u306a\u308a\u305d\u3046\u306a\u3082\u306e\u3092\u63a2\u3057\u305f\u7d50\u679c\u3001pg_trgm, pg_bigm, textsearc [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,13],"tags":[],"class_list":["post-4682","post","type-post","status-publish","format-standard","hentry","category-centos","category-postgresql"],"_links":{"self":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/4682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/comments?post=4682"}],"version-history":[{"count":7,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/4682\/revisions"}],"predecessor-version":[{"id":4689,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/4682\/revisions\/4689"}],"wp:attachment":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/media?parent=4682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/categories?post=4682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/tags?post=4682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}