From: Steinar H. Gunderson <sgunderson@bigfoot.com>
To: pgsql-performance@postgresql.org
Subject: Re: Improving performance on multicolumn query
Date: Wed, 9 Nov 2005 13:44:29 +0100
Message-ID: <20051109124429.GA9127@uio.no> (raw)
In-Reply-To: <4371E6A7.50808@web.de>
References: <4371E6A7.50808@web.de>
On Wed, Nov 09, 2005 at 01:08:07PM +0100, Jan Kesten wrote:
> Now my problem: I need really many queries of rows using it's primary
> key and fetching about five different columns but these are quite slow
> (about 10 queries per second and as I have some other databases which
> can have about 300 queries per second I think this is slow):
>
> transfer=> explain analyse SELECT * FROM test WHERE test_a=9091150001
> AND test_b=1 AND test_c=2 AND test_d=0 AND test_e=0;
>
> Index Scan using test_idx on test (cost=0.00..50.27 rows=1 width=1891)
> (actual time=0.161..0.167 rows=1 loops=1)
> Index Cond: (test_a = 9091150001::bigint)
> Filter: ((test_b = 1) AND (test_c = 2) AND (test_d = 0) AND (test_e 0))
You don't post your table definitions (please do), but it looks like test_b,
test_c, test_d and test_e might be bigints? If so, you may want to do
explicit "AND test_b=1::bigint AND test_c=2::bigint" etc. -- 7.4 doesn't
figure this out for you. (8.0 and higher does.)
/* Steinar */
--
Homepage: http://www.sesse.net/
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: sgunderson@bigfoot.com
Subject: Re: Improving performance on multicolumn query
In-Reply-To: <20051109124429.GA9127@uio.no>
* 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