Обсуждение: [PERFORM] Low priority batch insert

Поиск
Список
Период
Сортировка

[PERFORM] Low priority batch insert

От
Jean Baro
Дата:
Hi there,

That's my first question in this mailing list! :)

Is it possible (node.js connecting to PG 9.6 on RDS) to set a lower priority to a connection so that that particular process (BATCH INSERT) would have a low impact on other running processes on PG, like live queries and single inserts/updates?

I would like the batch insert to complete as soon as possible, but at the same time keep individual queries and inserts running on maximum speed.

SINGLE SELECTS (HIGH PRIORITY)
SINGLE INSERTS/UPDATES (HIGH PRIORITY)
BATCH INSERT (LOW PRIORITY)
BATCH SELECT (LOW PRIORITY)



Is that a good idea? Is this feasible with Node.js + PG?

Thanks

Re: [PERFORM] Low priority batch insert

От
Michael Paquier
Дата:
On Fri, Oct 20, 2017 at 1:10 AM, Jean Baro <jfbaro@gmail.com> wrote:
> That's my first question in this mailing list! :)

Welcome!

> Is it possible (node.js connecting to PG 9.6 on RDS) to set a lower priority
> to a connection so that that particular process (BATCH INSERT) would have a
> low impact on other running processes on PG, like live queries and single
> inserts/updates?
>
> Is that a good idea? Is this feasible with Node.js + PG?

The server could be changed so as backend processes use setpriority
and getpriority using a GUC parameter, and you could leverage priority
of processes using that. The good news is that this can be done as a
module, see an example from Fujii Masao's pg_cheat_funcs that caught
my attention actually yesterday:
https://github.com/MasaoFujii/pg_cheat_funcs/commit/a39ec1549e2af72bf101da5075c4e12d079f7c5b
The bad news is that you are on RDS, so vendor locking is preventing
you from loading any custom modules.
-- 
Michael


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance