Running two queries concurrently? - Mailing list pgsql-novice

From James David Smith
Subject Running two queries concurrently?
Date
Msg-id CAMu32AA72J=c7WCmS_bg0VnFrwd95gfBoUJhB+jVS56iSPG_bQ@mail.gmail.com
Whole thread Raw
Responses Re: Running two queries concurrently?
List pgsql-novice
Hi there,

The more and more that I use PostgreSQL the more technical my queries
are seeming to become, so here is the latest question/scenario I could
do with some advice on please. Take the following hypothetical
situation:

QueryOne: I select 10000 rows from TABLE A using CRITERIA Y, and
insert the result into TABLE B. This query takes 20 minutes to run.

QueryTwo: Two minutes after QueryOne has begun, I select 5000 rows
from TABLE A using CRITERIA X, and insert the result into TABLE B.
This query takes 10 minutes to run.

So my question really is, is this possible? I would have thought that
perhaps QueryOne puts a lock on TABLE A and TABLE B while it is
selecting data from one and inserting into the other, but maybe not?

At the moment I have to do QueryOne and then QueryTwo quite a few
times, but have been doing them one after another. Maybe I can
actually run them at the same time?

Best wishes

James


pgsql-novice by date:

Previous
From: e-letter
Date:
Subject: Re: apply sum function after group by extract month date
Next
From: David Johnston
Date:
Subject: Re: Running two queries concurrently?