# MetricBeat statements metricset

**URL:** <https://discuss.elastic.co/t/metricbeat-statements-metricset/131055>\
**Category:** Beats\
**Created:** [May 8, 2018, 7:49pm UTC](https://discuss.elastic.co/t/metricbeat-statements-metricset/131055 "2018-05-08T19:49:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zinefer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zinefer/32/29368_2.png) [@zinefer](https://discuss.elastic.co/u/zinefer)\
**Post date:** [May 8, 2018, 7:49pm UTC](https://discuss.elastic.co/t/metricbeat-statements-metricset/131055/1 "2018-05-08T19:49:25Z")

</div>

Is there any reason there is no metricset that relates to `pg_stat_statements`?

I've never done GO but I looked at, for example, the activity metricset and I think I might be able to make one for pg\_stat\_statements. Would there be any interest in something like that?

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [May 8, 2018, 8:20pm UTC](https://discuss.elastic.co/t/metricbeat-statements-metricset/131055/2 "2018-05-08T20:20:33Z")

</div>

Hello @zinefer, it's been a long time since I've used PostgreSQL, but aren't these stats provided by the `database` metricset?

---

<div class="post-metadata">

**Author:** ![zinefer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zinefer/32/29368_2.png) [@zinefer](https://discuss.elastic.co/u/zinefer)\
**Post date:** [May 8, 2018, 8:30pm UTC](https://discuss.elastic.co/t/metricbeat-statements-metricset/131055/3 "2018-05-08T20:30:44Z")

</div>

I think there is some overlap, but `pg_stat_statements` gives much more detailed information. For example, with `pg_stat_statements` I can:

- Calculate a Query Per Second
- Identify Long running Queries
- Calculate cpu usage per query
- Count unique queries
- Get blk data per query

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [May 8, 2018, 8:34pm UTC](https://discuss.elastic.co/t/metricbeat-statements-metricset/131055/4 "2018-05-08T20:34:00Z")

</div>

Seems like a nice improvements, I think you should create an issue on the official beats repository to discuss it with us, nothing stop you for creating a PR too 🙂

---

<div class="post-metadata">

**Author:** ![zinefer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zinefer/32/29368_2.png) [@zinefer](https://discuss.elastic.co/u/zinefer)\
**Post date:** [May 8, 2018, 8:43pm UTC](https://discuss.elastic.co/t/metricbeat-statements-metricset/131055/5 "2018-05-08T20:43:07Z")

</div>

Thank you!

I've taken the first step of creating an issue here: [https://github.com/elastic/beats/issues/7048](https://github.com/elastic/beats/issues/7048)

I will continue to look into making the necessary changes for a pull request.

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [May 8, 2018, 8:43pm UTC](https://discuss.elastic.co/t/metricbeat-statements-metricset/131055/6 "2018-05-08T20:43:43Z")

</div>

If you have any problem problem with configuring your environment don't hesitate to create a post in discuss.

---

<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:** [June 5, 2018, 10:43pm UTC](https://discuss.elastic.co/t/metricbeat-statements-metricset/131055/7 "2018-06-05T22:43:48Z")

</div>

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