From: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
To: Jan Kesten <jan.kesten@web.de>
Cc: pgsql-performance@postgresql.org
Subject: Re: Improving performance on multicolumn query
Date: Wed, 09 Nov 2005 21:19:33 +0800
Message-ID: <4371F765.1050209@familyhealth.com.au> (raw)
In-Reply-To: <4371E6A7.50808@web.de>
References: <4371E6A7.50808@web.de>
> 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))
>
> So, what to do to speed things up? If I understand correctly this
> output, the planner uses my index (test_idx is the same as test_pkey
> created along with the table), but only for the first column.
Hi Jan,
If you're using 7.4.x then the planner can't use the index for unquoted
bigints. Try this:
SELECT * FROM test WHERE test_a='9091150001' AND test_b='1' AND
test_c=''2 AND test_d='0' AND test_e='0';
Chris
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-performance@postgresql.org
Cc: chriskl@familyhealth.com.au, jan.kesten@web.de
Subject: Re: Improving performance on multicolumn query
In-Reply-To: <4371F765.1050209@familyhealth.com.au>
References: <4371E6A7.50808@web.de> <4371F765.1050209@familyhealth.com.au>
* 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