With this query I am trying to get the latest hour for a given timestamp so
that I can get whole health array of all object for a given hour. So I am
doing DISTINCT on mobid and order by hour and mobid DESC.
On Thu, Sep 14, 2017 at 6:03 PM, Subramaniam C
wrote:
> I created index on morbid and ho
I created index on morbid and hour together. Given below is the EXPLAIN
output
--
Unique (cost=606127.16..621098.42 rows=1087028 width=200)
-> Sort (cost=606127.16..613612.79 rows=2994252 width=200)
On 2017-09-14 13:51, Subramaniam C wrote:
Hi
QUERY :-
_select distinct on (health_timeseries.mobid) mobid,
health_timeseries.health, health_timeseries.hour from
health_timeseries where hour >=(1505211054000/(3600*1000))-1 and hour
<= 1505211054000/(3600*1000) ORDER BY health_timeseries.mobid DE
Hi
*Requirement :- *
We need to retrieve latest health of around 1.5 million objects for a given
time.
*Implementation :-*
We are storing hourly data of each object in single row. Given below is the
schema :-
*CREATE TABLE health_timeseries (*
* mobid text NOT NULL,
hour bigint NOT