Question On Unique Domains

What is the definition of Unique Domains for Pi-Hole?

Are they domains which are constantly used?
Are they domains that are not on blocklists?

I am a little confused to its definition and segregation.

Thanks for help in advance.

It's the number of domains on all your adlists after duplicates are removed.

Thanks for the response but that's a little confusing, because after a gravity base update you see this:


On querying the data base with:

SELECT last("unique_domains") FROM "http_pihole" WHERE $timeFilter GROUP BY time($__interval), "host" fill(null)


SELECT last("domains_being_blocked") FROM "http_pihole" WHERE $timeFilter

The numbers are totally different, domains blocked vs unique domains, there is definitely a segregation between total unique domains blocked and just unique domains. from the Pi-Hole DB. Don't be fooled by gravity, I believe it is just showing a total of unique domains, from blocklists, which excludes the duplicates. Therefore using the word unique.

From what I can see in the Pi-Hole DB, one is called "domains_being_blocked" and the other is "unique_domains". Both have a totally different count.

So whats the difference between the two?

  [i] Number of gravity domains: 605816 (400940 unique domains)
  [i] Number of exact blacklisted domains: 8
  [i] Number of regex blacklist filters: 26
  [i] Number of exact whitelisted domains: 11
  [i] Number of regex whitelist filters: 1
  [✓] Flushing DNS cache
  [✓] Cleaning up stray matter

  [✓] DNS service is running
  [✓] Pi-hole blocking is Enabled
nanopi@nanopi:~$ sqlite3 /etc/pihole/gravity.db "Select count(domain) from gravity;"
nanopi@nanopi:~$ sqlite3 /etc/pihole/gravity.db "Select count(distinct domain) from gravity;"

Which database are your querying?


The former is the number that has been blocked (due to you browsing), the latter is the de-duped count from the adlists.

Even still, total blocked queries, does not = unique domains? I am querying an Influx DB.

No because you could have been visiting multiple times. Pihole does not count how many (de-duped) sites you have been visiting. You can calculate the numbers yourself using the pihole-ftl.db.

Presumably you are running some kind of exporter that queries the API and stores the results in influx.. I would start there. Sounds like it exporter is misinterpreting the data in the Pi-hole database.

Docs for Pi-hole DB: