Re: many 'OR' in WHERE-condition - Mailing list pgsql-sql

From Richard Huxton
Subject Re: many 'OR' in WHERE-condition
Date
Msg-id 4628AB05.6000400@archonet.com
Whole thread Raw
In response to Re: many 'OR' in WHERE-condition  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Responses Re: many 'OR' in WHERE-condition  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List 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


pgsql-sql by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: many 'OR' in WHERE-condition
Next
From: "Rohit Khare"
Date:
Subject: Retrieve month from date