I have a table with time series column in the millisecond, I want to resample the time series and apply mean on the group. How can I implement it in Postgres?
"Resample" means aggregate all time stamps within one second or one minute. All rows within one second or one minute form a group.
table structure
date x y z
Use
date_trunc()
to truncate timestamps to a given unit of time, andGROUP BY
that expression:Assuming your misleadingly named
date
column is actually of typetimestamp
.Related answer with more details and links: