X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F1A67566CF for ; Tue, 22 Mar 2005 18:48:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32118-10 for ; Tue, 22 Mar 2005 18:48:32 +0000 (GMT) Received: from mail.astudios.com (ns1.astudios.com [66.49.77.3]) by svr1.postgresql.org (Postfix) with ESMTP id 055CE566C7 for ; Tue, 22 Mar 2005 18:48:30 +0000 (GMT) thread-index: AcUvEBGQBmW61W/tTd2KgI4h2pONmA== Received: from [10.4.13.50] ([66.194.26.150]) by mail.astudios.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 22 Mar 2005 13:50:50 -0500 Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 Message-ID: <424068B0.8090101@sermonaudio.com> Date: Tue, 22 Mar 2005 13:49:20 -0500 From: "Chris Hoover" User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Sabio - PSQL" Cc: "PostgreSQL Admin" Subject: Re: Too slow References: <42402A4B.70703@ceroriesgo.co.cr> In-Reply-To: <42402A4B.70703@ceroriesgo.co.cr> Content-Type: text/plain; format=flowed; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 22 Mar 2005 18:50:51.0015 (UTC) FILETIME=[1189C170:01C52F10] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200503/352 X-Sequence-Number: 16850 Sabio - PSQL wrote: > How can I improve speed on my queries. For example this query takes=20 > one day executing itself and it has not finalized !!! > "create table tmp_partes as select * from partes where identificacion=20 > not in (select cedula from sujetos)" > > partes have 1888000 rows, an index on identificacion > sujetos have 5500000 rows, an index on cedula > > > > > > ---------------------------(end of = broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > > try create table tmp_partes as select * from partes where not exists=20 (select cedula from sujetos where cedula =3D partes.identificacion); The "not in (subselect)" is very slow in postgresql. HTH, chris