Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4477E64FCEF for ; Thu, 21 Aug 2008 11:28:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08390-04 for ; Thu, 21 Aug 2008 11:27:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7F4E164FCE6 for ; Thu, 21 Aug 2008 11:28:04 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m7LES0xL023466; Thu, 21 Aug 2008 10:28:00 -0400 (EDT) To: =?ISO-8859-1?Q?Andr=E9_Volpato?= cc: pgsql-performance@postgresql.org Subject: Re: Postgres not using array In-reply-to: <48AD735D.6040403@ecomtecnologia.com.br> References: <48AC8292.5000708@ecomtecnologia.com.br> <48AD735D.6040403@ecomtecnologia.com.br> Comments: In-reply-to =?ISO-8859-1?Q?Andr=E9_Volpato?= message dated "Thu, 21 Aug 2008 10:53:33 -0300" Date: Thu, 21 Aug 2008 10:28:00 -0400 Message-ID: <23465.1219328880@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/249 X-Sequence-Number: 31130 =?ISO-8859-1?Q?Andr=E9_Volpato?= writes: > Explain output: > HashAggregate (cost=19826.23..19826.96 rows=73 width=160) (actual > time=11826.754..11826.754 rows=0 loops=1) > -> Subquery Scan b2 (cost=19167.71..19817.21 rows=722 width=160) > (actual time=11826.752..11826.752 rows=0 loops=1) > Filter: (bds_internacoes(200805, 200806, (b2.cod)::text, > 'qtdI'::text, 'P'::bpchar) >= 1::numeric) > -> Limit (cost=19167.71..19248.89 rows=2165 width=48) (actual > time=415.157..621.043 rows=28923 loops=1) So I guess the question is "what is the bds_internacoes function, and why is it so slow?" regards, tom lane