You're right - here's a short example:

Raw data:

> SELECT * FROM m
name: m
time                 f1 f2
----                 ---- ----
2016-11-30T17:16:09Z 1 12
2016-11-30T17:16:30Z 4 34
2016-11-30T17:18:29Z 56

The query below returns the last value of f1 and the value of f2 at that 
time. You can see this in the column headers - the header for last value of 
f1 is last and the header for the value of f2 is f2. 

> SELECT last(f1),f2 from m
name: m
time                 last f2
----                 ---- ----
2016-11-30T17:16:30Z 4 34    

The query below returns the last value of f1 and the last value of f2, 
independent of the last value of f1. InfluxDB returns 1970-01-01T00:00:00Z 
(the null timestamp equivalent) as the timestamp because it can't return 
two different timestamps for the same point.

> SELECT last(f1),last(f2) from m
name: m
time                 last last_1
----                 ---- ------
1970-01-01T00:00:00Z 4 56

I hope this helps. We're working on re-doing the functions page so I'll add 
this to the issue 
<https://github.com/influxdata/docs.influxdata.com/issues/757>. And yes, 
adding a time constraint in the WHERE clause should help a bit in 1.1, but 
it's not as necessary as it was in 1.0.

On Tuesday, November 29, 2016 at 6:39:31 AM UTC-8, [email protected] 
wrote:
>
> I wanted to confirm the behavior of LAST() to make sure I'm not relying on 
> something undocumented or likely to change. Because I couldn't find this in 
> the docs.
>
> If I do: 
>
> SELECT LAST(f1), f2 FROM m
>
> I am getting the last value of f1, say at time T, and the value of f2 ALSO 
> AT TIME T.
>
> If I do:
>
> SELECT LAST(f1), LAST(f2) from m
>
> I am getting the last value of f1, say at time T1, and the last value of 
> f2, which could be at time T2 ... ie, independently.
>
> Also, in the latest version (1.1), does it improve the performance to add 
> a time-restricting where clause? I.e, 'WHERE time > now() - 1h'
>
> Thanks!
>
>

-- 
Remember to include the version number!
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/c4976f3b-9b3d-48e8-aeff-21206681f402%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to