PostgreSQL, thanks to extensions, allows a third non-obvious file strategy. Since many developers when working with small images don't want to overload their solutions with the complexities of interacting with file servers, and I didn't want to store files in a database, I found and tried a third option. I turned PostgreSQL into a file server that provides page bytes exchange with the client using Bytea virtual tables. Roughly it looks like this: client-(access library-asynchronous page exchange)-PostgreSQL-Python-file system. I've set a limit of 2Gb, but working with such large files with this strategy doesn't seem reasonable to me. But the system for storing fiscal documents turned out pretty good (<10Mb).