pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nörder-Tuitje, Marcus <noerder-tuitje@technology.de>
To: pgsql-performance@postgresql.org
Subject: Optimizer misconfigured ?
Date: Thu, 13 Oct 2005 11:53:57 +0200
Message-ID: <16F953410A0F1346848DCB476A989CFE01D52D@swtexchange2.technology.de> (raw)



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

view thread (4+ messages)  latest in thread

Message-ID: <16F953410A0F1346848DCB476A989CFE01D52D@swtexchange2.technology.de>
Permalink:  ../16F953410A0F1346848DCB476A989CFE01D52D@swtexchange2.technology.de/
Also on:    postgresql.org/message-id/16F953410A0F1346848DCB476A989CFE01D52D@swtexchange2.technology.de

 · 

reply

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: noerder-tuitje@technology.de
  Subject: Re: Optimizer misconfigured ?
  In-Reply-To: <16F953410A0F1346848DCB476A989CFE01D52D@swtexchange2.technology.de>

* 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