{"id":9200,"date":"2015-12-16T09:00:14","date_gmt":"2015-12-16T00:00:14","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=9200"},"modified":"2018-11-14T16:33:46","modified_gmt":"2018-11-14T07:33:46","slug":"postgresql-fdw-%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6sql%e3%81%a7%e3%83%ad%e3%82%b0%e6%a4%9c%e7%b4%a2%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2015\/12\/16\/postgresql-fdw-%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6sql%e3%81%a7%e3%83%ad%e3%82%b0%e6%a4%9c%e7%b4%a2%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f\/","title":{"rendered":"PostgreSQL FDW \u3092\u4f5c\u3063\u3066SQL\u3067\u30ed\u30b0\u691c\u7d22\u3057\u3066\u307f\u305f"},"content":{"rendered":"

\u3053\u3093\u306b\u3061\u306f\u3001\u5bfa\u5ca1\u3067\u3059\u3002
\n\u3053\u308c\u306f TECHSCORE Advent Calendar 2015<\/a> \u306e16\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n

\u30b7\u30a7\u30eb\u82b8\u4eba\u3078\u306e\u9053\u306e\u308a\u306f\u967a\u3057\u3044<\/h2>\n

\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u904b\u7528\u696d\u52d9\u3067\u306f\u65e5\u3005\u5165\u3063\u3066\u304f\u308b\u554f\u3044\u5408\u308f\u305b\u306b\u5fdc\u3048\u308b\u305f\u3081\u3001\u30ed\u30b0\u304c\u4e26\u3093\u3060\u30b3\u30f3\u30bd\u30fc\u30eb\u3068\u7768\u3081\u3063\u3053\u3059\u308b\u6642\u9593\u306f\u6c7a\u3057\u3066\u77ed\u304f\u3042\u308a\u307e\u305b\u3093\u3002
\n\u6bce\u56de grep, cut, uniq \u306b sed \u3084 awk \u306a\u3093\u304b\u3082\u99c6\u4f7f\u3057\u3066\u30ed\u30b0\u8abf\u67fb\u3092\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u308f\u3051\u306a\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u304c\u306a\u304b\u306a\u304b\u5927\u5909\u306a\u308f\u3051\u3067\u2026\u2026\u3002<\/p>\n

\u719f\u7df4\u306e\u6280\u8853\u8005\u306f\u9a5a\u7570\u7684\u306a\u30b7\u30a7\u30eb\u82b8\u3092\u99c6\u4f7f\u3057\u3066\u76ee\u7684\u306e\u30c7\u30fc\u30bf\u3092\u30b6\u30af\u30b6\u30af\u3068\u91e3\u308a\u4e0a\u3052\u3066\u304f\u308b\u306e\u3082\u306e\u3067\u3059\u304c\u3001
\n\u305d\u3093\u306a\u30a2\u30af\u30ed\u30d0\u30c6\u30a3\u30c3\u30af\u306a\u8077\u4eba\u6280\u306f\u4e00\u671d\u4e00\u5915\u3067\u306b\u8eab\u306b\u3064\u304f\u3082\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n

\u305d\u3093\u306a\u6642\u3001\u30a2\u30d7\u30ea\u30a8\u30f3\u30b8\u30cb\u30a2\u306a\u3089\u3053\u3046\u601d\u3046\u308f\u3051\u3067\u3059\u3002
\n\u300c\u55da\u547c\u3001\u3053\u306e\u4f5c\u696d\u304c SQL \u3067\u51fa\u6765\u308c\u3070\u4ffa\u3060\u3063\u3066\u2026\u2026\u300d<\/p>\n

\u305d\u3093\u306a\u671b\u307f\u3092\u53f6\u3048\u308b\u305f\u3081\u306b\u306f\u3001 Fluentd \u306a\u3069\u3092\u4f7f\u3063\u3066\u30ed\u30b0\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u2026\u2026\u3068\u3044\u3046\u306e\u304c\u738b\u9053\u3067\u3057\u3087\u3046\u3002
\n\u3067\u3082\u3001\u4eca\u56de\u306f\u3082\u3063\u3068\u30ab\u30b8\u30e5\u30a2\u30eb\u306b\u751f\u30ed\u30b0\u304b\u3089\u691c\u7d22\u3059\u308b\u65b9\u6cd5\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n

PostgreSQL FDW<\/h2>\n

\u4eca\u56de\u3001\u30ed\u30b0\u691c\u7d22\u306b\u306fPostgreSQL\u306e Foreign Data Wrapper\uff08\u4ee5\u964dFDW\uff09\u3068\u3044\u3046\u6a5f\u80fd\u3092\u5229\u7528\u3057\u307e\u3059\u3002
\n FDW \u306f PostgreSQL9.1 \u304b\u3089\u642d\u8f09\u3055\u308c\u305f\u6a5f\u80fd\u3067\u3001\u65e5\u672c\u8a9e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3067\u306f\u300c\u5916\u90e8\u30c7\u30fc\u30bf\u30e9\u30c3\u30d1\u300d\u3068\u8a33\u3055\u308c\u3066\u304a\u308a\u3001PostgreSQL \u30b5\u30fc\u30d0\u5916\u90e8\u306e\u30c7\u30fc\u30bf\u3092\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5185\u306e\u4eee\u60f3\u7684\u306a\u30c6\u30fc\u30d6\u30eb\u3068\u3057\u3066\u30de\u30c3\u30d4\u30f3\u30b0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

PostgreSQL9.3 \u304b\u3089\u306f postgres_fdw<\/a> \u3068\u3044\u3046\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u6a19\u6e96\u3067\u7d44\u307f\u8fbc\u307e\u308c\u3066\u304a\u308a\u3001
\n \u5225\u30b5\u30fc\u30d0\u306b\u3042\u308b PostgreSQL \u306e\u30c6\u30fc\u30d6\u30eb\u3092\u3042\u305f\u304b\u3082\u30ed\u30fc\u30ab\u30ebDB\u306b\u5b58\u5728\u3059\u308b\u304b\u306e\u3088\u3046\u306b\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002
\n \u307e\u305f\u3001FDW \u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u5bfe\u5fdc\u3057\u3066\u3044\u308c\u3070\u3001SELECT \u3060\u3051\u3067\u306f\u306a\u304f INSERT\u3001UPDATE\u3001DELETE \u306b\u52a0\u3048\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306b\u3082\u5bfe\u5fdc\u3068\u3044\u3046\u9ad8\u6a5f\u80fd\u3063\u3077\u308a\u3067\u3001\u3082\u3061\u308d\u3093 postgres_fdw \u306f\u3053\u308c\u3089\u306b\u5168\u3066\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u3055\u3089\u306b\u51c4\u3044\u306e\u306f\u3001FDW\u3067\u64cd\u4f5c\u3067\u304d\u308b\u306e\u306fPostgreSQL\u3060\u3051\u3067\u306f\u306a\u3044\u70b9\u3067\u3059\u3002
\n \u3053\u3061\u3089\u306e
\u516c\u5f0fWiki<\/a>\u306b\u3042\u308b\u3088\u3046\u306b\u3001\u69d8\u3005\u306a FDW \u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u516c\u958b\u3055\u308c\u3066\u304a\u308a\u3001
\n MySQL\u3084Oracle\u306f\u3082\u3061\u308d\u3093\u3001MongoDB \u3084 Redis \u3068\u3044\u3063\u305f NoSQLDB \u3001\u3055\u3089\u306b\u306f CSV \u3084 Twitter \u307e\u3067 PostgreSQL \u3067\u64cd\u4f5c\u3067\u304d\u3066\u3057\u307e\u3046\u306e\u3067\u3059\u3002<\/p>\n

\u4f5c\u3063\u3066\u307f\u305f<\/h2>\n

\u4eca\u56de\u306f\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u4efb\u610f\u306e\u6b63\u898f\u8868\u73fe\u3067\u30d1\u30fc\u30b9\u3057\u305f\u30c7\u30fc\u30bf\u3092\u6271\u3046\u305f\u3081\u306e\u3001 logfile_fdw<\/a> \u3068\u3044\u3046 FDW \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u305f\u3002
\n \u672c\u6765 FDW \u306fC\u8a00\u8a9e\u3067\u5b9f\u88c5\u3059\u308b\u3082\u306e\u3067\u3059\u304c\u3001
Multicorn<\/a> \u3068\u3044\u3046\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u5229\u7528\u3059\u308c\u3070\u3001 Python \u3092\u4f7f\u3063\u3066\u3068\u3066\u3082\u7c21\u5358\u306b\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002
\n \u3069\u306e\u304f\u3089\u3044\u7c21\u5358\u304b\u3068\u3044\u3046\u3068\u3001\u521d\u3081\u3066 Python \u3092\u66f8\u3044\u305f\u7b46\u8005\u304c\u6570\u6642\u9593\u3067\u5b9f\u88c5\u3067\u304d\u3066\u3057\u307e\u3046\u304f\u3089\u3044\u7c21\u5358\u3067\u3059\u3002
\n \uff08 FDW \u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u306f\u307e\u305f\u5f8c\u65e5\u3054\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\uff09<\/p>\n

\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n

\u307e\u305a\u306f\u3001\u524d\u6e96\u5099\u3068\u3057\u3066\u30ed\u30b0\u304c\u4fdd\u7ba1\u3057\u3066\u3042\u308b\u30b5\u30fc\u30d0\u306b\u4ee5\u4e0b\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u6e08\u307e\u305b\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
\n yum \u3084 apt-get \u3067\u3055\u304f\u3063\u3068\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3057\u307e\u3048\u3070\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n