sqlite3 /etc/pihole/pihole-FTL.db "SELECT domain FROM queries LIMIT 100000;" > domains.list
NOTE: This will generate a list file with up to 100,000 domains.
You can increase the upper limit of domains, however, we suggest starting from a small number of domains to get realistic results in a reasonable period of time.
sudo pihole logging off
NOTE: The long-term database can be disabled by setting in /etc/pihole/pihole-FTL.conf :
DBFILE=
and running
sudo pihole restartdns
Set cache-size to a rather high value (maybe 25,000 - by guess roughly one-eighth to one-fourth number of the domains you extracted from the database earlier) in /etc/dnsmasq.d/01-pihole.conf :
cache-size=25000
and
sudo pihole restartdns
time dig -f domains.list +noall +answer > /dev/null
NOTE: This will show you how much time it takes to query the number of domains you extracted from the database.