From: | Soni M <diptatapa(at)gmail(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Query planner question |
Date: | 2014-08-21 01:16:25 |
Message-ID: | CAAMgDXnx57NMFXcrB7sE72djD4=3+3EPGNPOdEcwhJ0bEdVFXw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Everyone,
I have this query :
select t.ticket_id ,
tb.transmission_id
from ticket t,
transmission_base tb
where t.latest_transmission_id = tb.transmission_id
and t.ticket_number = tb.ticket_number
and tb.parse_date > ('2014-07-31');
Execution plan: http://explain.depesz.com/s/YAak
Indexes on ticket :
"ticket_pkey" PRIMARY KEY, btree (ticket_id) CLUSTER
"ticket_by_latest_transmission" btree (latest_transmission_id)
"ticket_by_ticket_number" btree (ticket_number)
This query only returns some portions of rows from ticket table.
The question is, Why does postgres need to get all the rows from ticket
table in order to complete this query?
Can't postgres use indexes to get only needed rows on ticket table?
I try set seqscan to off, but still index scan try to get all rows on
ticket table.
Here's the execution plan : http://explain.depesz.com/s/abH2
Thanks
--
Regards,
Soni Maula Harriz
From | Date | Subject | |
---|---|---|---|
Next Message | David G Johnston | 2014-08-21 02:26:54 | Re: Query planner question |
Previous Message | Larry White | 2014-08-20 21:17:34 | Re: JsonB Gin Index is very large; is there a work around? |