Skip to content

Calculating size of database can cause performance issues #1150

Open
@plaffitt

Description

@plaffitt

What did you do?

We operate a postgres cluster for a client that have thousands of databases.

postgres=# select count(*) from pg_database ;
 count
-------
  7771
(1 row)

Calculating the size of each database every time we poll the metrics cause serious performance issues and a filesystem overhead since this calculation is done by summing the size of each individual files of the database.

What did you expect to see?

We would like an option to disable metrics that relies on tasks that are purely related to the operating system and thus produce a lot of syscalls and especially fs/disk related ones that are slow by nature. In my understanding it would only affect the pgDatabaseSize metric, so maybe we just need an option to specifically disable this one.

What did you see instead? Under which circumstances?

I didn't find any option to disable a specific metric, especially the pgDatabaseSize metric.

Environment

Not relevant in this case IMHO.

PS: I would be happy to work on a pull request to add such an option if you're open to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions