Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 45E251337B9B for ; Fri, 15 Oct 2010 16:23:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 21977-02 for ; Fri, 15 Oct 2010 19:22:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from stan.prospectivdirect.com (mail.prospectiv.com [155.212.59.212]) by mail.postgresql.org (Postfix) with SMTP id 6EC881337B84 for ; Fri, 15 Oct 2010 16:22:53 -0300 (ADT) Received: (qmail 27815 invoked from network); 15 Oct 2010 19:22:53 -0000 Received: from unknown (HELO ?192.168.1.87?) (192.168.1.87) by 0 with SMTP; 15 Oct 2010 19:22:53 -0000 Subject: Re: oracle to psql migration - slow query in postgres From: Tony Capobianco To: pgsql-performance@postgresql.org In-Reply-To: References: <1287085384.1684.52.camel@tony1.localdomain> <1287166429.1730.170.camel@tony1.localdomain> Content-Type: text/plain; charset="UTF-8" Date: Fri, 15 Oct 2010 15:22:52 -0400 Message-ID: <1287170572.1730.173.camel@tony1.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/263 X-Sequence-Number: 40681 Very true Igor! Free is my favorite price. I'll figure a way around this issue. Thanks for your help. Tony On Fri, 2010-10-15 at 14:54 -0400, Igor Neyman wrote: > > -----Original Message----- > > From: Tony Capobianco [mailto:tcapobianco@prospectiv.com] > > Sent: Friday, October 15, 2010 2:14 PM > > To: pgsql-performance@postgresql.org > > Subject: Re: oracle to psql migration - slow query in postgres > > > > Thanks for all your responses. What's interesting is that an > > index is used when this query is executed in Oracle. It > > appears to do some parallel processing: > > > > SQL> set line 200 > > delete from plan_table; > > explain plan for > > select websiteid, emailaddress > > from members > > where emailok = 1 > > and emailbounced = 0; > > > > SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY()); > > SQL> > > 3 rows deleted. > > > > SQL> 2 3 4 5 > > Explained. > > > > SQL> SQL> > > PLAN_TABLE_OUTPUT > > -------------------------------------------------------------- > > -------------------------------------------------------------- > > -------------------------------------------------------------- > > -------------- > > Plan hash value: 4247959398 > > > > -------------------------------------------------------------- > > ----------------------------------------------------------------- > > | Id | Operation | Name | > > Rows | Bytes > > | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib | > > -------------------------------------------------------------- > > ----------------------------------------------------------------- > > | 0 | SELECT STATEMENT | | 237M| > > 7248M| 469K (2)| 01:49:33 | | | | > > | 1 | PX COORDINATOR | | | > > | | | | | | > > | 2 | PX SEND QC (RANDOM) | :TQ10000 | 237M| > > 7248M| 469K (2)| 01:49:33 | Q1,00 | P->S | QC (RAND) | > > | 3 | PX BLOCK ITERATOR | | 237M| > > 7248M| 469K (2)| 01:49:33 | Q1,00 | PCWC | | > > |* 4 | INDEX FAST FULL SCAN| MEMBERS_SORTED_IDX_001 | 237M| > > 7248M| 469K (2)| 01:49:33 | Q1,00 | PCWP | | > > -------------------------------------------------------------- > > ----------------------------------------------------------------- > > > > PLAN_TABLE_OUTPUT > > -------------------------------------------------------------- > > -------------------------------------------------------------- > > -------------------------------------------------------------- > > -------------- > > > > Predicate Information (identified by operation id): > > --------------------------------------------------- > > > > 4 - filter("EMAILBOUNCED"=0 AND "EMAILOK"=1) > > > > 16 rows selected. > > > > > > 1. Postgres doesn't have "FAST FULL SCAN" because even if all the info > is in the index, it need to visit the row in the table ("visibility" > issue). > > 2. Postgres doesn't have parallel executions. > > BUT, it's free anf has greate community support, as you already saw. > > Regards, > Igor Neyman >