Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-13 Thread Tim Jones
PROTECTED] Sent: Friday, February 10, 2006 6:25 PM To: Tim Jones Cc: pgsql-performance@postgresql.org Subject: RE: [PERFORM] joining two tables slow due to sequential scan OK, if I'm reading this correctly, it looks like the planner is choosing a sequential scan because it expects 48,000 row

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Dave Dutcher
TECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Jones Sent: Friday, February 10, 2006 4:59 PM To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] joining two tables slow due to sequential scan ok here is real db the first query I had seems to make no sense because it is

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Tim Jones
Friday, February 10, 2006 5:52 PM To: Tim Jones Cc: Scott Marlowe; Dave Dutcher; pgsql-performance@postgresql.org Subject: Re: [PERFORM] joining two tables slow due to sequential scan "Tim Jones" <[EMAIL PROTECTED]> writes: > QUERY PLAN > 'Hash Join (cost=899.83..43

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Tom Lane
"Tim Jones" <[EMAIL PROTECTED]> writes: > QUERY PLAN > 'Hash Join (cost=899.83..4384.17 rows=482 width=1350) (actual > time=0.203..0.203 rows=0 loops=1)' > ... > 'Total runtime: 0.392 ms' Hardly seems like evidence of a performance problem ... regards, tom lane -

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Scott Marlowe
On Fri, 2006-02-10 at 16:43, Tim Jones wrote: > oops > > QUERY PLAN > 'Hash Join (cost=899.83..4384.17 rows=482 width=1350) (actual > time=0.203..0.203 rows=0 loops=1)' > ' Hash Cond: ("outer".documentidentifier = > "inner".dssdocumentidentifier)' > ' -> Seq Scan on documentversions (cost=0.0

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Tom Lane
"Tim Jones" <[EMAIL PROTECTED]> writes: > QUERY PLAN > 'Hash Join (cost=899.83..4384.17 rows=482 width=1350)' > ' Hash Cond: ("outer".documentidentifier = > "inner".dssdocumentidentifier)' This is not EXPLAIN ANALYZE output. Also, the rowcount estimates seem far enough off in the other query to

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Tim Jones
ruary 10, 2006 5:39 PM To: Tim Jones Cc: Dave Dutcher; pgsql-performance@postgresql.org Subject: Re: [PERFORM] joining two tables slow due to sequential scan On Fri, 2006-02-10 at 16:37, Tim Jones wrote: > for first query > > QUERY PLAN > 'Limit (cost=4.69..88.47 rows=10 width

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Scott Marlowe
On Fri, 2006-02-10 at 16:37, Tim Jones wrote: > for first query > > QUERY PLAN > 'Limit (cost=4.69..88.47 rows=10 width=1350) (actual > time=32.195..32.338 rows=10 loops=1)' > ' -> Nested Loop (cost=4.69..4043.09 rows=482 width=1350) (actual > time=32.190..32.316 rows=10 loops=1)' > '-

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Tim Jones
' Recheck Cond: (patientidentifier = 123)' ' -> Bitmap Index Scan on ix_cdocpid (cost=0.00..4.69 rows=482 width=0)' 'Index Cond: (patientidentifier = 123)' thnx Tim Jones Healthcare Project Manager Optio Software, Inc. (

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Scott Marlowe
On Fri, 2006-02-10 at 16:35, Tim Jones wrote: > OK. I'm gonna make a couple of guesses here: > > 1: clinicaldocuments.patientidentifier is an int8 and you're running > 7.4 or before. > > -- nope int4 and 8.1 > > 2: There are more rows with clinicaldocuments.patientidentifier= 123 > than with

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Tim Jones
OK. I'm gonna make a couple of guesses here: 1: clinicaldocuments.patientidentifier is an int8 and you're running 7.4 or before. -- nope int4 and 8.1 2: There are more rows with clinicaldocuments.patientidentifier= 123 than with documentversions.documentstatus = 'AC'. -- nope generally spe

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Scott Marlowe
On Fri, 2006-02-10 at 16:06, Tim Jones wrote: > > I am trying to join two tables and keep getting a sequential scan in > the plan even though there is an index on the columns I am joining > on. Basically this the deal ... I have two tables with docid in them > which is what I am using for the j

Re: [PERFORM] joining two tables slow due to sequential scan

2006-02-10 Thread Dave Dutcher
What version of postgres are you using?  Can you post the output from EXPLAIN ANALYZE?     -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Jones Sent: Friday, February 10, 2006 4:07 PM To: pgsql-performance@postgresql.org Subject: [PERFORM]