Optimizer misconfigured ?

From: Nörder-Tuitje, Marcus <noerder-tuitje(at)technology(dot)de>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Optimizer misconfigured ?
Date: 2005-10-13 09:53:57
Message-ID: 16F953410A0F1346848DCB476A989CFE01D52D@swtexchange2.technology.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello,

I have a strange effect on upcoming structure :

DEX_OBJ ---< DEX_STRUCT >--- DEX_LIT

DEX_OBJ : 100 records (#DOO_ID, DOO_NAME)
DEX_STRUCT : 2,5 million records (#(DST_SEQ, FK_DOO_ID, FK_LIT_ID))
DEX_LIT : 150K records (#LIT_ID, LIT_TEXT)

(# marks primary key)

i'd like to count all LIT occurences in struct for a set of LITs.

so i indexed DEX_STRUCT using (FK_LIT_ID, FK_DOO_ID)
and i indexed DEX_LIT using BTREE (LIT_TEXT, LIT_ID)

but if i query

SELECT DOO_ID
, COUNT(FK_LIT_ID) AS occurences
FROM DEX_STRUCT STR
, DEX_LITERAL LIT
WHERE STR.FK_LIT_ID = LIT.LIT_ID
AND LIT_TEXT IN ('foo', 'bar', 'foobar')
GROUP BY DOO_ID

postgresql always runs a seq scan on DEX_STRUCT. I tried several indices and also very different kinds of queries (from EXISTS via INNER JOIN up to subqueries), but Pgsql does not use any index on dex_struct.

What can I do ? Is this a optimizer misconfiguration (hence, it is still in default config) ?

How can I make Pg using the indices on doc_struct ? The index on LIT is used :-(

I expect 30 - 60 millions of records in the struct table, so I urgently need indexed access.

Thanks a lot !

Marcus

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Markus Wollny 2005-10-13 10:16:49 Re: Help tuning postgres
Previous Message Csaba Nagy 2005-10-13 08:15:03 Re: Help tuning postgres