Re: [PERFORM] No index usage with "left join"

2004-08-02 Thread Scott Marlowe
On Mon, 2004-08-02 at 06:08, [EMAIL PROTECTED] wrote: > We have a "companies" and a "contacts" table with about 3000 records > each. > > We run the following SQL-Command which runs about 2 MINUTES !: > > SELECT count(*) FROM contacts LEFT JOIN companies ON contacts.sid = > companies.intfield01 >

Re: [PERFORM] No index usage with "left join"

2004-08-02 Thread Tom Lane
Rod Taylor <[EMAIL PROTECTED]> writes: >> How can I force the usage of the indexes when using "left join". > Anyway, we can be fairly sure this isn't PostgreSQL 7.4 (which would > likely choose a far better plan -- hash join rather than nested loop) Indeed, the lack of any join-condition line in

Re: [PERFORM] No index usage with "left join"

2004-08-02 Thread Rod Taylor
> SELECT count(*) FROM contacts LEFT JOIN companies ON contacts.sid = > companies.intfield01 > > contacts.sid (type text, b-tree index on it) > companies.intfield01 (type bigint, b-tree index on it) > How can I force the usage of the indexes when using "left join". Or > any other SQL construct th

Re: [PERFORM] No index usage with "left join"

2004-08-02 Thread Leeuw van der, Tim
Cannot you do a cast in your query? Does that help with using the indexes? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: maandag 2 augustus 2004 14:09 To: [EMAIL PROTECTED] Subject: [PERFORM] No index usage with "left join" We have