Re: [PERFORM] SQL performance

2013-06-02 Thread Robert DiFalco
Absolutely: explain analyze verbose select c.user_id from contact_entity c left outer join contact_entity c1 on c1.owner_id = c.user_id and c1.user_id = c.owner_id where NOT c.blocked AND NOT c1.blocked AND c.owner_id = 24 AND c.user_id != 24 AND c.user_id IS NOT NULL AND c1.user_id IS NOT NULL gr

Re: [PERFORM] SQL performance

2013-06-02 Thread Szymon Guz
On 2 June 2013 21:39, Robert DiFalco wrote: > I have a table called contacts. It has a BIGINT owner_id which references > a record in the user table. It also has a BIGINT user_id which may be null. > Additionally it has a BOOLEAN blocked column to indicate if a contact is > blocked. The final det

[PERFORM] SQL performance

2013-06-02 Thread Robert DiFalco
I have a table called contacts. It has a BIGINT owner_id which references a record in the user table. It also has a BIGINT user_id which may be null. Additionally it has a BOOLEAN blocked column to indicate if a contact is blocked. The final detail is that multiple contacts for an owner may referen