Re: [PERFORM] Performance issue with NestedLoop query

2015-07-31 Thread Qingqing Zhou
On Fri, Jul 31, 2015 at 10:55 AM, Ram N wrote: > > Thanks Qingqing for responding. That didn't help. It in fact increased the > scan time. Looks like a lot of time is being spent on the NestedLoop Join > than index lookups though I am not sure how to optimize the join. > Good news is that optimiz

Re: [PERFORM] Performance issue with NestedLoop query

2015-07-31 Thread Matheus de Oliveira
On Fri, Jul 31, 2015 at 3:06 PM, Matheus de Oliveira < matioli.math...@gmail.com> wrote: > CREATE INDEX ON table2 USING gin (tstzrange(start_date, end_date, > '()')); The index should be USING GIST, not GIN. Sorry. -- Matheus de Oliveira

Re: [PERFORM] Performance issue with NestedLoop query

2015-07-31 Thread Matheus de Oliveira
On Thu, Jul 30, 2015 at 4:51 AM, Ram N wrote: > select sum(a), count(id), a.ts, st from table1 a, table2 b where a.ts > > b.start_date and a.ts < b.end_date and a.ts > '2015-01-01 20:50:44.00 > +00:00:00' and a.ts < '2015-07-01 19:50:44.00 +00:00:00' group by a.ts, > st order by a.ts Yo

Re: [PERFORM] Performance issue with NestedLoop query

2015-07-31 Thread Ram N
Thanks Qingqing for responding. That didn't help. It in fact increased the scan time. Looks like a lot of time is being spent on the NestedLoop Join than index lookups though I am not sure how to optimize the join. I am assuming its in memory join, so I am not sure why it should take such a lot of