Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4DCE96347C9 for ; Fri, 6 Mar 2009 07:40:56 -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 09322-02 for ; Fri, 6 Mar 2009 07:40:53 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from el-out-1112.google.com (el-out-1112.google.com [209.85.162.180]) by mail.postgresql.org (Postfix) with ESMTP id 196BD6344E8 for ; Fri, 6 Mar 2009 07:40:52 -0400 (AST) Received: by el-out-1112.google.com with SMTP id y26so331806ele.10 for ; Fri, 06 Mar 2009 03:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=67s9ZLZ7nf8alVv0ujabj2NVRT7J0RVFWUHlsF7Yo1E=; b=b6EU7IpO+eethi81BkyegKkw75G7tCHyEFLMUkWb3fYDnyYak6xYBm4OqefKuL0HYc /LI70M3i4O1E4+UQl5P+KjNSvc0tWRnqGpFIlCExMNBtq7CE/xDBQCSomHWY2GbqStux cnE4D3PvKZqpEMStFfQAbT137vBcnVpbX3L3o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=m9gaALDPXJbzP/z2qC29RazTQPZwC2S+geZU6GPjUyF8pKT5hk1Cy2D4CgWB3Q6zNt hwuX8/K8kANmQSJDgQjnBxFC5tZJGVd9KESFr40xCHnd3FkeobX6+0D9Rf3ZFOHMIiLI xA70QgH55yMAiGlQjtJQ4lwxZKElkNnuyuMLE= MIME-Version: 1.0 Received: by 10.90.100.20 with SMTP id x20mr597858agb.37.1236339651194; Fri, 06 Mar 2009 03:40:51 -0800 (PST) In-Reply-To: <49B0FFE4.2030202@megafon.hr> References: <49B0FFE4.2030202@megafon.hr> Date: Fri, 6 Mar 2009 06:40:51 -0500 X-Google-Sender-Auth: fe9fb0fca9bb2799 Message-ID: <491f66a50903060340r59a8b4e1v165f3374dc40e389@mail.gmail.com> Subject: Re: Forcing postgres NOT to use sequential scan, trough JDBC From: Dave Cramer To: Mario Splivalo Cc: pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=0016361e87f0bb2f1e046471c116 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200903/22 X-Sequence-Number: 19352 --0016361e87f0bb2f1e046471c116 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I would suggest to you that something else is wrong. In order for postgresql to use the most efficient method all of the tuning parameters have to be configured properly. The performance list is a better place to discuss this. On Fri, Mar 6, 2009 at 5:50 AM, Mario Splivalo wrote: > How do I tell postgres not to use sequential scan, trough jdbc? > > I tried to include 'SET enable_seqscan TO false;' at the begining of the > plpgsql function, but that seems to work only if I call the function trough > the psql, and only for the subsequent calls in the current session. I 'know' > that postgres is using sequential scan because function call takes cca > 400ms. When I force postgres not to use sequential scan, the function takes > around 5-10ms. > > I even tried, on the same connection, to issue 'SET enable_seqscan TO > false;' trough jdbc before I call my function, but execution time is still > around 400ms. > > Mike > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc > --0016361e87f0bb2f1e046471c116 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I would suggest to you that something else is wrong. In order for postgresq= l to use the most efficient method all of the tuning parameters have to be = configured properly. The performance list is a better place to discuss this= .

On Fri, Mar 6, 2009 at 5:50 AM, Mario Spliva= lo <mario= .splivalo@megafon.hr> wrote:
How do I tell postgres not to use sequential scan, trough jdbc?

I tried to include 'SET enable_seqscan TO false;' at the begining o= f the plpgsql function, but that seems to work only if I call the function = trough the psql, and only for the subsequent calls in the current session. = I 'know' that postgres is using sequential scan because function ca= ll takes cca 400ms. When I force postgres not to use sequential scan, the f= unction takes around 5-10ms.

I even tried, on the same connection, to issue 'SET enable_seqscan TO f= alse;' trough jdbc before I call my function, but execution time is sti= ll around 400ms.

=A0 =A0 =A0 =A0Mike

--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

--0016361e87f0bb2f1e046471c116--