pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Stephen Frost <sfrost@snowman.net>
To: Ivan Voras <ivoras@gmail.com>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: Sort-of replication for reporting purposes
Date: Fri, 6 Jan 2017 14:43:03 -0500
Message-ID: <20170106194303.GU18360@tamriel.snowman.net> (raw )
In-Reply-To: <CAF-QHFXC=DLeQqLMfmsbPq5-Tegi0TNi_zPkrd_SL8zUXijH6w@mail.gmail.com >
References: <CAF-QHFVvGit2UK6ez5jKqexsmyrHpZw5hwFeRoiT2oC=OvaN8A@mail.gmail.com >
<CAF-QHFXj1adiYaXzmwwSkNc2HE5ng27Foze7mDTNS9x=w-okoA@mail.gmail.com >
<CAF-QHFVSZYxNHf+VDqrw_SJ_5mEhDfxF=N6zKmZfQttNAdGF2w@mail.gmail.com >
<CAF-QHFU54UqB0NEpahnsc5TmOCA1WzW-mY4FYchH8+=s5sYAUQ@mail.gmail.com >
<CAF-QHFXLRfCuTHfiq_38fEdWxD3qYrm_TDzUQDAm1cUQ9QyA9A@mail.gmail.com >
<CAF-QHFUxvMYXPj-ufT-ivobXmj8-0AGSmPh8hBwrzLvSoZfzsw@mail.gmail.com >
<CAF-QHFVP5O+JZH7LfjoGrgT=_OqPujpHbM5kpwjdffLoNJA10g@mail.gmail.com >
<CAF-QHFUk7QsV21LzexC45n3ODNYBU7Kj+fh_EB59mXYw4aCq7Q@mail.gmail.com >
<CAF-QHFXBhJxZyJ9ifBf2GJY1VXjjbV2nbZGHv34Wd50Ura=Qjg@mail.gmail.com >
<CAF-QHFXC=DLeQqLMfmsbPq5-Tegi0TNi_zPkrd_SL8zUXijH6w@mail.gmail.com >
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
Ivan,
* Ivan Voras (ivoras@gmail.com) wrote:
> I'm investigating options for an environment which has about a dozen
> servers and several dozen databases on each, and they occasionally need to
> run huge reports which slow down other services. This is of course "legacy
> code". After some discussion, the idea is to offload these reports to
> separate servers - and that would be fairly straightforward if not for the
> fact that the report code creates temp tables which are not allowed on
> read-only hot standby replicas.
You could create a new server which has postgres_fdw connections to your
read-only replicas and run the reporting code there. That could suck,
of course, since the data would have to be pulled across to be
aggregated (assuming that's what your reporting script is doing).
If you can't change the reporting script at all, that might be what you
have to do though. Be sure to look at the postgres_fdw options about
batch size and how planning is done.
If you can change the reporting script, another option is to create FDWs
on your primary servers with FDW tables that point to some other server
and then have the reporting script use the FDW tables as the temp or
destination tables on the replica. The magic here is that FDW tables on
a read-only replica *can* be written to, but you have to create the FDW
and the FDW tables on the primary and let them be replicated.
As also mentioned, you could use trigger-based replication (eg: bucardo,
slony, etc) instead of block-based, or you could look at the logical
replication capabilities (pg_logical) to see about using that for your
replica-for-reporting instead.
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
view thread (10+ messages) latest in thread
Message-ID: <20170106194303.GU18360@tamriel.snowman.net>
Permalink: ../20170106194303.GU18360@tamriel.snowman.net/
Also on: postgresql.org/message-id/20170106194303.GU18360@tamriel.snowman.net
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: sfrost@snowman.net, ivoras@gmail.com
Subject: Re: Sort-of replication for reporting purposes
In-Reply-To: <20170106194303.GU18360@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox