Probably not the file size is the issue, but the free disk space? Although, as long as you did not move the existing database to a different disk, free space is obviously not the issue. Not sure if the Raspbian SQLite3 build (targeting armv6hf) has some changed limits, but I doubt it.
You use the 32-bit image, or is it the 64-bit image (which uses the regular Debian arm64 repository)?
Indeed, 4 GiB file size should not be an issue on this RPi system with official Raspberry Pi Foundation kernel and ext4 file system. But for a micro SD card, a frequently written 4 GiB file won't be of joy for long, in terms of SD card wear, assuming that there is some disk write overhead involved when doing even small changes to large SQLite databases.
From the docs: Query database - Pi-hole documentation
Another way of controlling the size of the long-term database is by setting a maximum age for log queries to keep using the config parameter
MAXDBDAYS . It defaults to 365 days, i.e. queries that are older than one year get periodically removed to limit the growth of the long-term database file.
In case you don't need access logs for one year, you should be able to reduce the database size dramatically by reducing the max age by adding/setting e.g.
/etc/pihole/pihole-FTL.conf to have logs for one week only.
If you require long-term logs, moving the database to an external drive (no SD card) is probably the best solution, e.g.:
OOT: In addition to the max age setting, a max size setting could be actually nice, in cases where keeping the database size below a limit is more important than a consistent log age. Has such a request been done already? Can find it here or on GitHub at least .