Multicolumn index - is there a limit?

From: Fran Fabrizio <ffabrizio(at)exchange(dot)webmd(dot)net>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Multicolumn index - is there a limit?
Date: 2001-05-01 16:51:39
Message-ID: 3AEEE99B.ED27CDC7@exchange.webmd.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,

In continuing my quest from yesterday to speed up some INSERTs I'm doing, I
came across a SELECT statement in my trigger that is taking .433 seconds to
run. Here is a sample query:

select * from status s where s.site_id = 18 and s.host_id = 49 and
s.product = 'BETA' and s.class = 'APPS' and s.subclass = 'MONITOR' ;

I had drastically increased performance of some other queries this morning
by adding a multicolumn index on the table, so I thought I would try here
as well. Here's the table and the index I created:

Table "status"
Attribute | Type | Modifier
-----------+-----------+----------
site_id | bigint | not null
host_id | bigint | not null
product | varchar() | not null
class | varchar() | not null
subclass | varchar() | not null
status | varchar() | not null
msg | varchar() |
tstamp | timestamp |
Indices: status_5_column_index,
status_host_id_key,
status_site_id_key

The query I used to create the index: create index status_5_column_index
on status (site_id, host_id, product, class, subclass);

I then ran some tests. It's still taking .433 seconds on average. Is a 5
column multicolumn index too much for postgres to handle? Is my query not
using the index at all? Is my database designed horrendously and the mere
fact that I have a select with 5 where conditions making you ill? :-) It
worked for two columns this morning, so I thought I'd give this a shot.

Thanks,
Fran

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fran Fabrizio 2001-05-01 17:05:56 Stranger than fiction...
Previous Message Chris Hayner 2001-05-01 16:39:23 making with ssl support