From: | "Moray McConnachie" <moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk> |
---|---|
To: | "Fabrice Scemama" <fabrices(at)ximmo(dot)ftd(dot)fr>, <pgsql-general(at)hub(dot)org> |
Subject: | Re: Accelerating subqueries |
Date: | 2000-04-06 15:56:31 |
Message-ID: | 009501bf9fe0$acf87d00$760e01a3@oucs.ox.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
----- Original Message -----
From: "Fabrice Scemama" <fabrices(at)ximmo(dot)ftd(dot)fr>
To: <pgsql-general(at)hub(dot)org>
Sent: Thursday, April 06, 2000 4:03 PM
Subject: [GENERAL] Accelerating subqueries
> Hi fellow PostgreSQL users.
>
> Here's a query:
>
> DELETE FROM Annonces WHERE Id_Ag IN
> (
> SELECT Id FROM Installs
> WHERE Si_Compte_Actif = 'f'
> );
>
DELETE FROM Annonces WHERE EXISTS (SELECT Id FROM Installs WHERE
Si_Compte_Actif ='f' AND Installs.Id=Annonces.Id_Ag);
ought to be a lot faster if you have indices on all concerned fields.
But this should be faster still;
DELETE FROM Annonces WHERE Annonces.Id_Ag=Installs.Id AND
Installs.Si_Compte_Actif='f';
Yours,
Moray
From | Date | Subject | |
---|---|---|---|
Next Message | Nilesh A. Phadke | 2000-04-06 16:59:45 | Fetching from cursor.... |
Previous Message | Ed Loehr | 2000-04-06 15:36:23 | Re: Accelerating subqueries |