Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A31779FBAEA for ; Thu, 29 Mar 2007 16:33:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 56090-07-3 for ; Thu, 29 Mar 2007 16:33:11 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by postgresql.org (Postfix) with ESMTP id CF8949FBDBD for ; Thu, 29 Mar 2007 15:55:44 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so552969ugf for ; Thu, 29 Mar 2007 11:55:43 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:to:subject:date:user-agent:mime-version:content-type:content-transfer-encoding:content-disposition:message-id:from; b=M9Y6wrbVU5Uytdac7Nq42Fl5JACGLS9P8ZAVRViBKfcn9GLhdQP35sc4cKZp4Pg+ZEkBw1ioPmwbKMkU+bAc2Qh3UbpaNA4BZ7kqRhnAZInaYPkI1gD9oGHGhCIpObtJwDIFI77uCEw+R1b2oDieBJFKPguvpeFo4p5QiosLK84= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:to:subject:date:user-agent:mime-version:content-type:content-transfer-encoding:content-disposition:message-id:from; b=oSOVg42BQIfV4UJGCnbO1zTq+Y0VFLzoDBhqNZDL3PV3z88vJZ5emP4p5r9El2i0jBw7QzBmSsWc2Is0B2EtfGyMhWYTmhPWKxkD7QuPadC6qKF+MSpKh4/0WNSi8IeFAzbykxk578Y3gQcfUkbRjjFklHXGUMdMoPUtmLzfLkw= Received: by 10.67.92.9 with SMTP id u9mr1376145ugl.1175194543564; Thu, 29 Mar 2007 11:55:43 -0700 (PDT) Received: from ?192.168.128.42? ( [62.94.40.205]) by mx.google.com with ESMTP id 24sm2345834ugf.2007.03.29.11.55.42; Thu, 29 Mar 2007 11:55:43 -0700 (PDT) To: pgsql-performance@postgresql.org Subject: Weird performance drop Date: Thu, 29 Mar 2007 20:56:07 +0200 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200703292056.08459.Vincenzo.Romano@gmail.com> From: Vincenzo Romano X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/420 X-Sequence-Number: 23825 Hi all. I'm running PostgreSQL v8.1.8 (under Linux Ubuntu). A function body is written as "language sql stable". There is just a select for a search in a view with two arguments to do the search. The search is done with equality comparisons. Both the function call and the select alone run very fast thanks to the indexes on the right columns I presume. Then I create a twin function where part of the comparison is done with the "like" operator on one of the very same columns as the previous case. While the function call is very slow, the select alone runs almost as fast as in the case of equality comparison. I thought that the query planner usually did a bad job on function bodies because they'd appear opaque to it. In this case it seems to me that the body is opaque only if I use the "like" operator. Any hint? -- Vincenzo Romano ---- Maybe Computers will never become as intelligent as Humans. For sure they won't ever become so stupid. [VR-1987]