pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Optimizer misconfigured ?
4+ messages / 2 participants
[nested] [flat]

* Optimizer misconfigured ?
@ 2005-10-13 09:53 Nörder-Tuitje, Marcus <noerder-tuitje@technology.de>
  2005-10-13 10:21 ` Re: Optimizer misconfigured ? Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Nörder-Tuitje, Marcus @ 2005-10-13 09:53 UTC (permalink / raw)
  To: 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

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Optimizer misconfigured ?
  2005-10-13 09:53 Optimizer misconfigured ? Nörder-Tuitje, Marcus <noerder-tuitje@technology.de>
@ 2005-10-13 10:21 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Richard Huxton @ 2005-10-13 10:21 UTC (permalink / raw)
  To: Marcus <noerder-tuitje@technology.de>; +Cc: pgsql-performance

Nörder-Tuitje wrote:
> 
> Hello, 
> 
> I have a strange effect on upcoming structure :

People will be wanting the output of EXPLAIN ANALYSE on that query.

They'll also ask whether you've VACUUMed, ANALYSEd and configured your 
postgresql.conf correctly.

-- 
   Richard Huxton
   Archonet Ltd





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Optimizer misconfigured ?
@ 2005-10-14 07:31 Nörder-Tuitje, Marcus <noerder-tuitje@technology.de>
  2005-10-14 07:38 ` Re: Optimizer misconfigured ? Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Nörder-Tuitje, Marcus @ 2005-10-14 07:31 UTC (permalink / raw)
  To: Richard Huxton <dev@archonet.com>; +Cc: pgsql-performance

Hi,

meanwhile I have received the hint to make postgres use the index via

SET ENABLE_SEQSCAN=FALSE;

which fits perfectly. The execution plan now indicates full use of index.

Nevertheless this is merely a workaround. Maybe the io-costs are configured to cheap.

thanks :-)


-----Ursprüngliche Nachricht-----
Von: Richard Huxton [mailto:dev@archonet.com]
Gesendet: Donnerstag, 13. Oktober 2005 12:22
An: Nörder-Tuitje, Marcus
Cc: pgsql-performance@postgresql.org
Betreff: Re: [PERFORM] Optimizer misconfigured ?


Nörder-Tuitje wrote:
> 
> Hello, 
> 
> I have a strange effect on upcoming structure :

People will be wanting the output of EXPLAIN ANALYSE on that query.

They'll also ask whether you've VACUUMed, ANALYSEd and configured your 
postgresql.conf correctly.

-- 
   Richard Huxton
   Archonet Ltd







^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Optimizer misconfigured ?
  2005-10-14 07:31 Re: Optimizer misconfigured ? Nörder-Tuitje, Marcus <noerder-tuitje@technology.de>
@ 2005-10-14 07:38 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Richard Huxton @ 2005-10-14 07:38 UTC (permalink / raw)
  To: Nörder-Tuitje@archonet.com, Marcus <noerder-tuitje@Technology.de>; +Cc: pgsql-performance

Nörder-Tuitje wrote:
> Hi,
> 
> meanwhile I have received the hint to make postgres use the index via
> 
> 
> SET ENABLE_SEQSCAN=FALSE;
> 
> which fits perfectly. The execution plan now indicates full use of
> index.

What execution plan? I still only see one message on the list.

> Nevertheless this is merely a workaround. Maybe the io-costs are
> configured to cheap.

Possibly - the explain analyse will show you.
--
   Richard Huxton
   Archonet Ltd




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-10-14 07:38 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-13 09:53 Optimizer misconfigured ? Nörder-Tuitje, Marcus <noerder-tuitje@technology.de>
2005-10-13 10:21 ` Richard Huxton <dev@archonet.com>
2005-10-14 07:31 Re: Optimizer misconfigured ? Nörder-Tuitje, Marcus <noerder-tuitje@technology.de>
2005-10-14 07:38 ` Richard Huxton <dev@archonet.com>

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