Skip to content

Instantly share code, notes, and snippets.

@kitsuyui
Last active November 2, 2016 14:31
Show Gist options
  • Save kitsuyui/2ce05422a86fb65d718963f97a8e6dc8 to your computer and use it in GitHub Desktop.
Save kitsuyui/2ce05422a86fb65d718963f97a8e6dc8 to your computer and use it in GitHub Desktop.
Docker で PostgreSQL の FDW を使って MySQL や Redis と JOIN してみた ref: http://qiita.com/kitsuyui/items/c2cd38daa78d1eb07a3c
FROM quay.io/aptible/postgresql:9.5-contrib
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install git gcc make libhiredis-dev \
&& mkdir -p /inst/ \
&& cd /inst \
&& git clone https://github.com/pg-redis-fdw/redis_fdw.git --branch REL9_5_STABLE --single-branch \
&& cd /inst/redis_fdw \
&& PATH=/usr/local/postgresql/bin/:$PATH make USE_PGXS=1 \
&& PATH=/usr/local/postgresql/bin/:$PATH make USE_PGXS=1 install \
&& apt-get purge -y --auto-remove git gcc make \
&& rm -Rf /inst
SELECT *
FROM sample_redis AS SR
INNER JOIN sample_mysql AS SM
ON SR.val::int = SM.id
INNER JOIN sample_postgres AS SP
ON SR.key = SP.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment