Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 91C87634242 for ; Fri, 6 Mar 2009 06:50:31 -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 49935-09 for ; Fri, 6 Mar 2009 06:50:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from megafon.hr (megafon.hr [213.202.104.5]) by mail.postgresql.org (Postfix) with ESMTP id EEDF06331B4 for ; Fri, 6 Mar 2009 06:50:22 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by megafon.hr (Postfix) with ESMTP id C9950864002 for ; Fri, 6 Mar 2009 11:50:19 +0100 (CET) X-Virus-Scanned: ClamAV at megafon.hr Received: from megafon.hr ([127.0.0.1]) by localhost (localhost.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q3S6DM1nnayT for ; Fri, 6 Mar 2009 11:50:12 +0100 (CET) Received: from [192.168.1.94] (unknown [212.92.194.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mike) by megafon.hr (Postfix) with ESMTP id 0504E864001 for ; Fri, 6 Mar 2009 11:50:11 +0100 (CET) Message-ID: <49B0FFE4.2030202@megafon.hr> Date: Fri, 06 Mar 2009 11:50:12 +0100 From: Mario Splivalo User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Forcing postgres NOT to use sequential scan, trough JDBC Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: 200903/21 X-Sequence-Number: 19351 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