Search Postgresql Archives

Re: Query planner question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, August 20, 2014, Soni M <diptatapa@xxxxxxxxx> wrote:
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?


It can, but having separate indexes on latest_transmission_id and ticket_number is not going to work.

You need a joint index on both columns.
 
 Cheers,

Jeff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux