Re: many 'OR' in WHERE-condition

From: Richard Huxton <dev(at)archonet(dot)com>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: many 'OR' in WHERE-condition
Date: 2007-04-20 11:59:01
Message-ID: 4628AB05.6000400@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

A. Kretschmer wrote:
>
> It's not my problem - i found it in a forum (german)
> http://pg-forum.de/showthread.php?t=1332
>
> If the list contains up to 195 entrys -> up to 195 bitmap index scans
> and BitmapOr -> 7.839ms
>
> If the list contains 196 entrys -> seq-scan -> 5591.567ms

It looks like it's getting the row estimate badly wrong.

"Seq Scan on t_datasets_searchindices_rel (cost=0.00..129053.50
rows=159277 width=4) (actual time=0.213..5590.435 rows=325 loops=1)

Probably worth increasing the statistics estimate for that column (ALTER
TABLE ... ALTER COLUMN ... SET STATISTICS=N)

It also looks like it's getting the cost estimates badly wrong. Probably
worth asking the original poster to read the tuning guide.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rohit Khare 2007-04-20 12:19:33 Retrieve month from date
Previous Message A. Kretschmer 2007-04-20 11:29:30 Re: many 'OR' in WHERE-condition