Re: [PERFORM] Performance problems, bad estimates and plan

2005-06-08 Thread Tom Lane
Allan Wang <[EMAIL PROTECTED]> writes: > No, the tiles row doesn't join with cities: Uh-huh, so it's the same issue described here: http://archives.postgresql.org/pgsql-performance/2005-05/msg00219.php This is fixed in CVS tip but the change was large enough that I'm disinclined to try to back-po

Re: [PERFORM] Performance problems, bad estimates and plan

2005-06-08 Thread Tom Lane
[ Please cc your responses to the list; other people may be interested in the same problem ] Allan Wang <[EMAIL PROTECTED]> writes: > On Wed, 2005-06-08 at 13:39 -0400, Tom Lane wrote: >> Are there any NULLs in c.playerid? > Here is the contents of cities: I'm sorry, what I should've said is "

Re: [PERFORM] Performance problems, bad estimates and plan

2005-06-08 Thread Tom Lane
Allan Wang <[EMAIL PROTECTED]> writes: > On Wed, 2005-06-08 at 13:02 -0400, Tom Lane wrote: >> Are you running 7.4.8 or 8.0.2 or later? > I'm running 8.0.2 on Gentoo. Oh, OK [ looks again ... ] I read the join backward, the issue I was concerned about would've applied to a right join there not l

Re: [PERFORM] Performance problems, bad estimates and plan

2005-06-08 Thread Tom Lane
Allan Wang <[EMAIL PROTECTED]> writes: > It seems that Postgres is estimating that all rows in a 50k row table > will be returned, but only one should match. I think this is the same issue fixed here: 2005-04-03 21:43 tgl * src/backend/optimizer/path/: costsize.c (REL7_4_STABLE),

[PERFORM] Performance problems, bad estimates and plan

2005-06-08 Thread Allan Wang
It seems that Postgres is estimating that all rows in a 50k row table will be returned, but only one should match. The query runs slow because of the seqscan. When I set enable_seqscan to off, then it does an index scan and it runs quickly. I've set the statistics target on the index to 100 and 10