If this is true and the flash is aging very quickly, then I should store /tmp/adguardhome/data/querylog.json somewhere else, like attaching a USB device onto the router. This would be done inside the AGH config at /etc/adguardhome.yaml.
I don't know why AGH is creating so much data, where Pi-Hole on my RPi didn't. A possible cause might be wpad, since 6,83 % of all queries are related to wpad domains, coming from 3 different clients (that's about 4500 wpad queries per day). But that's another issue.
Do you have any other ideas? Am I missing something? What would you consider best practice?
I'm pretty sure /tmp/ (tmpfs) is in ram per the standard images so anything written there has no usage of flash storage and disapears at every boot. You would have to reconfigure the system to have /tmp/ be on disk / flash storage.
I can see how you might think so but historically every place that data is at rest is considered storage, from CPU registers/cache and DRAM for program heap and stack space as primary storage, to hard drives, SSDs, flash drives, RAM Disks etc as secondary storage, and tertiary storage on media like magnetic tape, optical CD/DVD, and even paper tape and punch cards.
see https://en.wikipedia.org/wiki/Computer_data_storage for a more full explanation.
General use computers usually make use of virtual memory, using slow but inexpensive magnetic disk/SSD/flash disk (secondary storage) emulating primary storage to have more programs with large data sets running concurrently.
Systems like our OpenWrt router/firewall units have more DRAM than is needed for primary storage but lack robust secondary storage that support large write cycle counts so the secondary storage is emulated in DRAM, though it is volatile and unable to persist beyond a power cycle.
NAND is not RAM.
NAND or NOR Flash storage on devices like home routers, switches and APs is used to hold the software to boot and run the system along with the added packages and configuration files etc. On devices with wifi, the radio calibration settings are stored on flash and there can be a few other things on there.
A simplified answer is that flash storage is used like the hard drive on a PC or flash on a smart phone. The difference is that SOHO router type devices tend to minimize frequent writes to flash so they use /tmp/ on RAM for volatile storage.
In your first post, you show output with a list of partitions on the flash. mtdblock0 - mtdblock15.
All your questions can be answered if you reboot the router.
Are your old queries still there after a reboot?
If yes, then we're all wrong and you're right.
If the queries are gone, I have a question: What is the "statistical reason" to keep the queries in RAM and also in a file that also resides in RAM if they are gone anyway after a reboot?
LE: replaced stats with queries since we were talking about the querylog.json.
Those 480.7MB are the portion of the 512MB of the DRAM chip on the system board reported as available to the operating system and applications. The other 31.3MB is reserved and/or otherwise not available to the operating system and applications.
The default setting in OpenWrt for the /tmp/ file system is to use about 1/2 of the available RAM so there is RAM available for dynamic allocation to other system components and applications that run.