H...I'm not sure why the buffers option didn't work for me, maybe the
heroku psql is out of date. No, the query gets slower with a high load of
data and runs pretty often.
I just created a small test dataset for this. When I have a larger one I
will post new explain plans but the timings seem
UNION and subselect both performed better than EXISTS for this particular
case.
On Thu, Nov 21, 2013 at 12:31 PM, desmodemone wrote:
> Hi Robert, could you try with "exists" ?
>
> SELECT c.*
> FROM contacts c
> WHERE exists ( SELECT 1 FROM phone p WHERE p.addr =? and p.contact_id=
> c.id )
On Thu, Nov 21, 2013 at 2:04 PM, Robert DiFalco wrote:
> H...I'm not sure why the buffers option didn't work for me, maybe the
> heroku psql is out of date.
>
Did you enclose it in brackets? Eg. "EXPLAIN (ANALYZE, BUFFERS) SELECT ..."
On Thu, Nov 21, 2013 at 2:58 PM, bricklen wrote:
>
> Did you enclose it in brackets? Eg. "EXPLAIN (ANALYZE, BUFFERS) SELECT ..."
>
Never mind, I see it further down. My apologies.
No I didn't, thank you. I missed the parens.
On Thu, Nov 21, 2013 at 2:58 PM, bricklen wrote:
> On Thu, Nov 21, 2013 at 2:04 PM, Robert DiFalco
> wrote:
>
>> H...I'm not sure why the buffers option didn't work for me, maybe the
>> heroku psql is out of date.
>>
>
> Did you enclose it in b
I have found this:
SELECT c.*
FROM contacts c
WHERE c.id IN ( SELECT p.contact_id FROM phone p WHERE p.addr = ? )
OR c.id IN (SELECT e.contact_id FROM email e WHERE e.addr = ? );
To have a worse plan than:
SELECT * FROM contacts where id IN (
( SELECT c.id FROM contacts c
JOIN phone p ON c.id =
Sorry I couldn't get buffers to work but here is the explain analyze
verbose:
dft1fjfv106r48=> explain analyze verbose select c.*
from contacts c
where c.id IN (
select p.contact_id
Could you please attache the plan with explain buffers verbose?
thank you
2013/11/21 Robert DiFalco
> UNION and subselect both performed better than EXISTS for this particular
> case.
>
>
> On Thu, Nov 21, 2013 at 12:31 PM, desmodemone wrote:
>
>> Hi Robert, could you try with "exists" ?
>>
>>
Hi Robert, could you try with "exists" ?
SELECT c.*
FROM contacts c
WHERE exists ( SELECT 1 FROM phone p WHERE p.addr =? and p.contact_id=
c.id )
OR exists (SELECT 1 FROM email e WHERE e.addr = ? and e.contact_id=c.id );
2013/11/21 Robert DiFalco
> I have found this:
>
> SELECT c.*
>