Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 72756650148 for ; Thu, 6 Nov 2008 12:33:36 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 82838-09 for ; Thu, 6 Nov 2008 12:33:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ti-out-0910.google.com (ti-out-0910.google.com [209.85.142.190]) by mail.postgresql.org (Postfix) with ESMTP id C656765016F for ; Thu, 6 Nov 2008 12:33:32 -0400 (AST) Received: by ti-out-0910.google.com with SMTP id y8so403023tia.5 for ; Thu, 06 Nov 2008 08:33:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:subject :cc:in-reply-to:mime-version:content-type:references; bh=VqDBtalN8L81xm60tOMFYCnWrebqLwqRXPD4CTqbkPM=; b=g2GWBvTlkHI8XRJUwbPk5X/IcYFcblD10YYcVGX1uThd4VjTuXtm70RLIoFwe+jgHB FlfzItnRzyAU24J3SVaY0QINGdr5rRIchmtOVamZZHYrDD98kauzz4wlGYB2EwisAaFO Y53ZOv0Z18x/LRT54Dap+RtgpXMYE3y1vtwHw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:subject:cc:in-reply-to:mime-version :content-type:references; b=buoDR9AbTnnVGtOPFSh8RYoOIZ8Zl+yp59TmffCIUdPeqxOJDfQbyLstMjCF1ZH9F1 tJa/D+2Axe82hYVpyj1gCnhVEEythMjQvSwJF1Y5N8Wv4G7oYWOZKBrcgrcwYeFvZDBF 88+cxSqegc0ckv5z4x0XHLKi0L5nv28eFYkFw= Received: by 10.65.215.14 with SMTP id s14mr2494390qbq.5.1225989207992; Thu, 06 Nov 2008 08:33:27 -0800 (PST) Received: by 10.64.142.18 with HTTP; Thu, 6 Nov 2008 08:33:27 -0800 (PST) Message-ID: <331e40660811060833l49bf837em41ca88d4b2061ea1@mail.gmail.com> Date: Thu, 6 Nov 2008 18:33:27 +0200 From: "=?ISO-8859-5?B?svbi0Nv22SDC2Nzn2OjY3Q==?=" Subject: Re: PostgreSQL OR performance Cc: pgsql-performance@postgresql.org In-Reply-To: <29e3942f0811060426k5fe34b1av401a2dba62e4ae3c@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_26087_10777943.1225989208024" References: <331e40660811050312u552cab53ifa88e493e1c4f7ac@mail.gmail.com> <1225902700.1432.53.camel@jdavis> <331e40660811060246m51df553egd4e2ba91f08d1434@mail.gmail.com> <29e3942f0811060426k5fe34b1av401a2dba62e4ae3c@mail.gmail.com> X-Archive-Number: 200811/29 X-Sequence-Number: 31760 ------=_Part_26087_10777943.1225989208024 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 2008/11/6 Helio Campos Mello de Andrade > For what i see in four OR-plan.txt tou are doing too much "sequencial sca= n" > . Create some indexes for those tables using the fields that you use an i= t > may help you. > > OBS: If you already have lots of indexes in your tables it may be a good > time for you re-think your strategy because it=B4s ot working. > Tips: > 1 - create indexes for the tables with the fields that you will use in > the query if it is your most important query. If you have others querys t= hat > are used please post those here and we can help you to desing a better pl= an. As you can see from other plans, it do have all the indexes to perform it's work fast (when given part by part). It simply do not wish to use them. My question: Is this a configuration problem or postgresql optimizer simply can't do such a query rewrite? Actually I did rewrite the query to work properly as you can see from union-plan.txt. My question is if postgresql can do this automatically because such a rewrite is not always easy/possible (esp. for generated queries)? ------=_Part_26087_10777943.1225989208024 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

2008/11/6 Helio Campos Mello de Andrade = <helio.campo= s@gmail.com>
For what i see in four OR-plan.txt tou are doing too much "sequencial = scan" . Create some indexes for those tables using the fields that you= use an it may help you.

OBS: If you already have lots of indexes in= your tables it may be a good time for you re-think your strategy because i= t=B4s ot working.
Tips:
  1 - create indexes for the tables with the fields that you= will use in the query if it is your most important query. If you have othe= rs querys that are used please post those here and we can help you to desin= g a better plan.

As you can see from other plans, it do have all the indexes to per= form it's work fast (when given part by part). It simply do not wish to= use them. My question: Is this a configuration problem or postgresql optim= izer simply can't do such a query rewrite?
 
Actually I did rewrite the query to work properly as you = can see from union-plan.txt. My question is if postgresql can do this autom= atically because such a rewrite is not always easy/possible (esp. for gener= ated queries)?

------=_Part_26087_10777943.1225989208024--