Re: [PERFORM] Self-join query and index usage

2006-07-14 Thread Tom Lane
[EMAIL PROTECTED] writes: > and the query that I would like to run is: > SELECT e1.endnode, count(*), sum(e1.weight) AS weight1, sum(e2.weight) > AS weight2 > FROM event e1, event e2 > WHERE e1.endnode = e2.startnode AND e1.starttime < e2.starttime AND > e2.starttime < e1.endtime > GROUP BY e1.end

[PERFORM] Self-join query and index usage

2006-07-14 Thread worky . workerson
I'm doing a self join of some shipping data and wanted to get the best query possible. The interesting table is the event table, and it has the following structure: startnode int, endnode int, weight int, starttime timestamp, endtime timestamp and the query that I would like to run is: