Time bucketing query performance

From: Julian Wilson <julianwlsn(at)gmail(dot)com>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Time bucketing query performance
Date: 2018-05-07 23:33:17
Message-ID: CAPP28tKsOwnJKDS7i+W5hdO26_F+tm5fGxeDQ9rzuCf9YF=38A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I'm trying to debug improve the performance of my time bucketing query.
What I'm trying to do is essentially bucket by an arbitrary interval and
then do some aggregations within that interval (min,max,sum, etc). I am
using a `max` in the query I posted. For context in the data, it is 1
minute candles of cryptocurrency data (open price, high price, low price,
close price, volume, for an interval). I want to transform this to a 10
minute interval, on demand, and that is what this query is meant to do.

I understand the slow part of my query is in the LEFT JOIN, but I just
can't quite figure out how to do it without the LEFT JOIN.

Here is my pastebin with all the details so I don't clutter the message. I
tried to follow everything in the 'Slow Query Questions' WIKI page. There
is also a depesz link there.

https://ybin.me/p/9d3f52d88b4b2a46#kYLotYpNuIjjbp2P4l3la8fGSJIV0p+opH4sPq1m2/Y=

Thank for your help,

Julian

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Justin Pryzby 2018-05-08 01:08:57 Re: Time bucketing query performance
Previous Message David Rowley 2018-05-06 00:33:36 Re: help in analysis of execution plans