forked from ossc-db/pg_plan_advsr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pg_plan_advsr11/Dockerfile pg_plan_advsr11/build.sh pg_plan_advsr11/create_extensions.sh
- Loading branch information
1 parent
644be1d
commit 13e8705
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
FROM postgres:11 | ||
|
||
MAINTAINER [email protected] | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
build-essential \ | ||
bc \ | ||
libpam-dev \ | ||
libedit-dev \ | ||
libkrb5-dev \ | ||
libssl-dev \ | ||
libselinux-dev \ | ||
libpam-dev \ | ||
libkrb5-dev \ | ||
zlib1g-dev \ | ||
libedit-dev \ | ||
wget \ | ||
vim \ | ||
postgresql-server-dev-11 \ | ||
postgresql-client-11 \ | ||
postgresql-contrib-11 \ | ||
libpq-dev | ||
|
||
# Workaround. See:https://github.com/zalando/spilo/pull/229/commits/dfd74c94e060f9b8b5c080d66846657aaa21bae8 | ||
RUN ln -snf /usr/lib/postgresql/${version}/lib/libpgcommon.a /usr/lib/x86_64-linux-gnu/libpgcommon.a && \ | ||
ln -snf /usr/lib/postgresql/${version}/lib/libpgport.a /usr/lib/x86_64-linux-gnu/libpgport.a | ||
|
||
# Get extensions | ||
RUN git clone https://github.com/ossc-db/pg_hint_plan.git && \ | ||
wget https://github.com/ossc-db/pg_store_plans/archive/1.3.tar.gz && \ | ||
git clone https://github.com/ossc-db/pg_plan_advsr.git pg_plan_advsr | ||
|
||
# Copy files for pg_plan_advsr | ||
RUN cd pg_hint_plan && git checkout PG11 && cp pg_stat_statements.c ../pg_plan_advsr/ && \ | ||
cp normalize_query.h ../pg_plan_advsr/ && \ | ||
cd .. && tar xvzf 1.3.tar.gz && cp pg_store_plans-1.3/pgsp_json*.[ch] pg_plan_advsr/ | ||
|
||
# Build & install | ||
RUN cd pg_hint_plan && make -s && make -s install && \ | ||
export PATH=$PATH:/usr/lib/postgresql/11/bin && cd ../pg_store_plans-1.3 && make USE_PGXS=1 all install && \ | ||
cd ../pg_plan_advsr && make -s && make -s install | ||
|
||
# Create extensons | ||
## you can use create_extensions.sh by postgres user manualy | ||
COPY ./create_extensions.sh /docker-entrypoint-initdb.d/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
docker build -t test/pg_plan_advsr:11 . && \ | ||
docker run -d --name pg_plan_advsr11 test/pg_plan_advsr:11 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
# Edit postgresql.conf | ||
echo "shared_preload_libraries = 'pg_hint_plan, pg_plan_advsr, pg_store_plans'" >> /var/lib/postgresql/data/postgresql.conf | ||
echo "max_parallel_workers_per_gather = 0" >> /var/lib/postgresql/data/postgresql.conf | ||
echo "max_parallel_workers = 0" >> /var/lib/postgresql/data/postgresql.conf | ||
echo "geqo_threshold = 20" >> /var/lib/postgresql/data/postgresql.conf | ||
echo "from_collapse_limit = 16" >> /var/lib/postgresql/data/postgresql.conf | ||
echo "join_collapse_limit = 16" >> /var/lib/postgresql/data/postgresql.conf | ||
echo "random_page_cost = 2" >> /var/lib/postgresql/data/postgresql.conf | ||
|
||
# Create extensons | ||
psql -c "create extension pg_hint_plan;" | ||
psql -c "create extension pg_store_plans;" | ||
psql -c "create extension pg_plan_advsr;" | ||
|