From: Mario Splivalo <mario.splivalo@megafon.hr>
To: pgsql-jdbc@postgresql.org
Subject: Re: Forcing postgres NOT to use sequential scan, trough JDBC
Date: Mon, 09 Mar 2009 10:02:09 +0100
Message-ID: <49B4DB11.6040008@megafon.hr> (raw)
In-Reply-To: <49B0FFE4.2030202@megafon.hr>
References: <49B0FFE4.2030202@megafon.hr>
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.
>
As it turns out, one can say 'SET senable_seqscan TO false;' at the
begining of the plpgsql function. The problem was that I had setup
Tomcat so that it keeps only 10 persistent connections. When I set it up
to keep 100 persistent connections the load was minimal.
Mike
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: mario.splivalo@megafon.hr
Subject: Re: Forcing postgres NOT to use sequential scan, trough JDBC
In-Reply-To: <49B4DB11.6040008@megafon.hr>
References: <49B0FFE4.2030202@megafon.hr> <49B4DB11.6040008@megafon.hr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox