Re: Querying sporadic time series type data. - Mailing list pgsql-sql

From David G. Johnston
Subject Re: Querying sporadic time series type data.
Date
Msg-id CAKFQuwY14gequNuS4=s+ed-dD85BHOC8yxR0Gthvd4uh=q=45w@mail.gmail.com
Whole thread Raw
In response to Re: Querying sporadic time series type data.  (Tim Uckun <timuckun@gmail.com>)
Responses Re: Querying sporadic time series type data.
List pgsql-sql
The convention here is to inline or bottom-post.

On Saturday, October 3, 2020, Tim Uckun <timuckun@gmail.com> wrote:
Given the scale I am working at I thought a specific time scale
database would be overkill but I'll look into it nevertheless.  Even
if I do write the queries with the known metrics I am still trying to
figure out how to efficiently query "last known value of this metric
on or before X time" without a correlated subquery which would be a
massively inefficient query.

Yes, if the time is arbitrary you are stuck with a where clause, sort-and-limit.  DISTINCT ON can be useful for returning multiple entities over the same metric.

Indexes, possibly partial (if you don’t normalize the model), should help.

Even massively inefficient can be efficient enough...

David J.

pgsql-sql by date:

Previous
From: Tim Uckun
Date:
Subject: Re: Querying sporadic time series type data.
Next
From: Steven Pousty
Date:
Subject: Re: Querying sporadic time series type data.