From 8ff25dca8eb579f7c17e0cc0833c8ad8fa3344f7 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Fri, 23 May 2025 08:08:32 +0300 Subject: [PATCH] Add online_advisor extension (#11898) ## Problem Detect problems with Postgres optimiser: lack of indexes and statistics ## Summary of changes https://github.com/knizhnik/online_advisor Add online_advistor extension to docker image --------- Co-authored-by: Konstantin Knizhnik --- compute/compute-node.Dockerfile | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/compute/compute-node.Dockerfile b/compute/compute-node.Dockerfile index 17e50697db..3e2c09493f 100644 --- a/compute/compute-node.Dockerfile +++ b/compute/compute-node.Dockerfile @@ -582,6 +582,38 @@ RUN make -j $(getconf _NPROCESSORS_ONLN) && \ make -j $(getconf _NPROCESSORS_ONLN) install && \ echo 'trusted = true' >> /usr/local/pgsql/share/extension/hypopg.control +######################################################################################### +# +# Layer "online_advisor-build" +# compile online_advisor extension +# +######################################################################################### +FROM build-deps AS online_advisor-src +ARG PG_VERSION + +# online_advisor supports all Postgres version starting from PG14, but prior to PG17 has to be included in preload_shared_libraries +# last release 1.0 - May 15, 2025 +WORKDIR /ext-src +RUN case "${PG_VERSION:?}" in \ + "v17") \ + ;; \ + *) \ + echo "skipping the version of online_advistor for $PG_VERSION" && exit 0 \ + ;; \ + esac && \ + wget https://github.com/knizhnik/online_advisor/archive/refs/tags/1.0.tar.gz -O online_advisor.tar.gz && \ + echo "059b7d9e5a90013a58bdd22e9505b88406ce05790675eb2d8434e5b215652d54 online_advisor.tar.gz" | sha256sum --check && \ + mkdir online_advisor-src && cd online_advisor-src && tar xzf ../online_advisor.tar.gz --strip-components=1 -C . + +FROM pg-build AS online_advisor-build +COPY --from=online_advisor-src /ext-src/ /ext-src/ +WORKDIR /ext-src/ +RUN if [ -d online_advisor-src ]; then \ + cd online_advisor-src && \ + make -j install && \ + echo 'trusted = true' >> /usr/local/pgsql/share/extension/online_advisor.control; \ + fi + ######################################################################################### # # Layer "pg_hashids-build" @@ -1648,6 +1680,7 @@ COPY --from=pg_jsonschema-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=pg_graphql-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=pg_tiktoken-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=hypopg-build /usr/local/pgsql/ /usr/local/pgsql/ +COPY --from=online_advisor-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=pg_hashids-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=rum-build /usr/local/pgsql/ /usr/local/pgsql/ COPY --from=pgtap-build /usr/local/pgsql/ /usr/local/pgsql/ @@ -1823,6 +1856,7 @@ COPY --from=pgjwt-src /ext-src/ /ext-src/ COPY --from=pg_graphql-src /ext-src/ /ext-src/ #COPY --from=pg_tiktoken-src /ext-src/ /ext-src/ COPY --from=hypopg-src /ext-src/ /ext-src/ +COPY --from=online_advisor-src /ext-src/ /ext-src/ COPY --from=pg_hashids-src /ext-src/ /ext-src/ COPY --from=rum-src /ext-src/ /ext-src/ COPY --from=pgtap-src /ext-src/ /ext-src/