influxdata / influxdata/influxdb

Count all points in a database

Open
#21,717 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Proposal:
Return the total amount of points in a database.

Current behavior:
Currently this is only possible by counting all points in each measurement in a database with SELECT COUNT(*) FROM "measurementName" queries and then summing the results of those queries up. The bad thing about this is, that these queries can take a lot of time if there are a lot of points (several hundred millions, over a billion or even more).

Desired behavior:
It would be much faster, if the total number of the points per database are already stored somewhere. Maybe in a measurement that exists per database and that is created by the InfluxDB service itself? This number should also be persisted and not reset to zero when the InfluxDB service restarts.

Alternatives considered:
A possible solution would also be to just return all written points without considering already deleted points. That would make things a bit easier I guess.

Use case:
For us this is important, because we want to be able to see quite fast, which databases actually hold a lot of points and which not. We do not fill the databases ourself. We provide InfluxDB databases to our users and the databases get created automatically if a user requests one on our self developed IoT platform.

Because of this, right now we have no quick and easy overview about which databases are actually used a lot and which not.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by tracing how databases record point writes, deletions, and persisted metadata, then determine where an aggregate count could be maintained across restarts. Done means a fast database-level point total is available and its behavior for deleted points is defined.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.