Michael Fuhr wrote:
On Fri, Mar 30, 2007 at 12:08:26PM +0200, Gaetano Mendola wrote:
Claus Guttesen wrote:
Try changing random_page_cost from the default 4 to 2 in postgresql.conf:

random_page_cost = 2
I have tuned that number already at 2.5, lowering it to 2 doesn't change
the plan.
The following 19-fold overestimate is influencing the rest of the
plan:

-> Seq Scan on l_pvcp (cost=0.00..2.17 rows=19 width=4) (actual time=0.066..0.081 rows=1 loops=1)
Filter: (value ~~* '%pi%'::text)

Have you tried increasing the statistics target on l_pvcp.value?
I ran your queries against canned data in 8.2.3 and better statistics
resulted in more accurate row count estimates for this and other
parts of the plan. I don't recall if estimates for non-leading-character
matches in earlier versions can benefit from better statistics.

test=# alter table l_pvcp alter column value set statistics 1000;
ALTER TABLE
test=# analyze l_pvcp;
ANALYZE
test=# explain analyze SELECT COUNT(id) FROM t_oa_2_00_card WHERE pvcp in (select id from l_pvcp where value ilike '%pi%');
QUERY PLAN
- ---------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=154321.83..154321.84 rows=1 width=8) (actual time=4948.627..4948.628 rows=1 loops=1)
-> Hash IN Join (cost=2.22..153877.08 rows=177898 width=8) (actual time=2.262..4940.395 rows=7801 loops=1)
Hash Cond: ("outer".pvcp = "inner".id)
-> Seq Scan on t_oa_2_00_card (cost=0.00..147695.25 rows=880125 width=12) (actual time=0.040..3850.074 rows=877682 loops=1)
-> Hash (cost=2.17..2.17 rows=19 width=4) (actual time=0.073..0.073 rows=1 loops=1)
-> Seq Scan on l_pvcp (cost=0.00..2.17 rows=19 width=4) (actual time=0.052..0.067 rows=1 loops=1)
Filter: (value ~~* '%pi%'::text)
Total runtime: 4948.717 ms
(8 rows)


and nothing changed.


Regards
Gaetano Mendola

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 10 of 15 | next ›
Discussion Overview
grouppgsql-performance @
categoriespostgresql
postedMar 30, '07 at 9:33a
activeApr 2, '07 at 10:42a
posts15
users7
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase