Running two queries concurrently?

From: James David Smith <james(dot)david(dot)smith(at)gmail(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Running two queries concurrently?
Date: 2013-09-10 14:54:58
Message-ID: CAMu32AA72J=c7WCmS_bg0VnFrwd95gfBoUJhB+jVS56iSPG_bQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David Johnston 2013-09-10 16:00:34 Re: Running two queries concurrently?
Previous Message e-letter 2013-09-10 09:56:27 Re: apply sum function after group by extract month date