# Visualice postgresql stats with Timelion

**URL:** <https://discuss.elastic.co/t/visualice-postgresql-stats-with-timelion/167726>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [February 9, 2019, 5:37pm UTC](https://discuss.elastic.co/t/visualice-postgresql-stats-with-timelion/167726 "2019-02-09T17:37:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![juanmav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juanmav/32/40704_2.png) [@juanmav](https://discuss.elastic.co/u/juanmav)\
**Post date:** [February 9, 2019, 5:37pm UTC](https://discuss.elastic.co/t/visualice-postgresql-stats-with-timelion/167726/1 "2019-02-09T17:37:40Z")

</div>

I was wondering how to make a Timelion visualisation for PostgreSQL stats. I was able to config Metricbeat module and collect data, it is sending data every 30s.

 ![Screenshot%20from%202019-02-09%2014-18-31](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e29b9ab28b2bade81645cb7fe58fa7658ef1bf53.png)

How can I draw the delta of the field "postgresql.database.rows.updated" as this field shows the total count of updated rows (and not the real progress). I want to show the different values occurring during the process (in my case every 30 seconds).

Thanks  
Juan Manuel

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [February 18, 2019, 7:22pm UTC](https://discuss.elastic.co/t/visualice-postgresql-stats-with-timelion/167726/2 "2019-02-18T19:22:14Z")

</div>

@timroes can we please get some help?

Thanks.  
Bhavya

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [February 19, 2019, 10:04am UTC](https://discuss.elastic.co/t/visualice-postgresql-stats-with-timelion/167726/3 "2019-02-19T10:04:32Z")

</div>

Hi Juan,

you can use that knowledge that every package is 30 seconds apart and build an expression, that looks around like the following:

```auto
.es(metric=sum:postgressql.database.rows.updated).subtract(.es(metric=sum:postgressql.database.rows.updated, offset=-30s))

```

That will always subtract the value of 30s before from the current value and thus you only see the change. I stripped out unnecessary things in that expression, so you might need to make sure your working on the right `index` and `timefield`.

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![juanmav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juanmav/32/40704_2.png) [@juanmav](https://discuss.elastic.co/u/juanmav)\
**Post date:** [February 19, 2019, 2:38pm UTC](https://discuss.elastic.co/t/visualice-postgresql-stats-with-timelion/167726/4 "2019-02-19T14:38:01Z")

</div>

@timroes Thanks for the response! I've resolved the problem using "_exist_" expression.

`.es(_exists_:postgresql.database.rows.inserted).if(eq, 0, null, .es(index=metricbeat*, ....`

But in the end I learned using the visual constructor of Kibana and derivate aggregate function.

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 19, 2019, 2:38pm UTC](https://discuss.elastic.co/t/visualice-postgresql-stats-with-timelion/167726/5 "2019-03-19T14:38:06Z")

</div>

Closed on March 19, 2019, 2:38pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
