Flux to PostgreSQL derivative unit 1s

Hi,

how can i write this “derivative” to Postgresql ?

from(bucket:  "${bucket}")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "kernel")
  |> filter(fn: (r) => r.host == "${host}")
  |> filter(fn: (r) => r["_field"] == "context_switches")
  |> derivative(unit: 1s, nonNegative: true)
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")
SELECT time, context_switches
FROM kernel WHERE host LIKE '$host' AND $__timeFilter(time) ORDER BY time DESC

This is my Postgresql without the derivative unit.

Hello @starfoxfs ,

please provide the dummy data that help to undersrtand the problem and screen shoot as you aspect the output

Yeah sure its the official Telegraf Dashboard for InfluxDB:


The Graph Visualiszation without the derivative Unit in PostgreSQL is completly another