- Original Message -
From: "Fabrice Scemama" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 06, 2000 4:03 PM
Subject: [GENERAL] Accelerating subqueries
> Hi fellow PostgreSQL users.
>
> Here's a query:
>
> DELETE FROM Annonc
Fabrice Scemama wrote:
>
> DELETE FROM Annonces WHERE Id_Ag IN
> (
> SELECT Id FROM Installs
> WHERE Si_Compte_Actif = 'f'
> );
>
> This query will take more than one hour of CPU time
> Any ideas about a way to write a single query that fast ?
http://www.postgresql.org/docs/faq-english
Fabrice Scemama wrote:
>
> Hi fellow PostgreSQL users.
>
> Here's a query:
>
> DELETE FROM Annonces WHERE Id_Ag IN
> (
> SELECT Id FROM Installs
> WHERE Si_Compte_Actif = 'f'
> );
The IN Clause is known to be very very slow. Use the
EXISTS Clause instead.
Regards Herbie
--
~
Hi fellow PostgreSQL users.
Here's a query:
DELETE FROM Annonces WHERE Id_Ag IN
(
SELECT Id FROM Installs
WHERE Si_Compte_Actif = 'f'
);
This query will take more than one hour of CPU time
on a PII 333 to execute. Table Installs has about 3000
tuples, and table Annonces about 50.000 .
A