Mysql – How to MySQL’s data types with 4GB limits be fully used since max_allowed_packet is hard limited to 1GB


The MySQL types LONGTEXT and LONGBLOB are documented with data limits of L + 4 bytes, where L < 2^32 (~4GB). But max_allowed_packet is only configurable up to 1GB.

The largest possible packet that can be transmitted to or from a MySQL
8.0 server or client is 1GB.

Wouldn't that mean the limit of LONGTEXT and LONGBLOG is actually ~1GB? The JSON type is limited by max_allowed_packet but the text/blob types do not mention the same limitation. Are there ways to work with those types, maybe in fragments, to work within the packet limit?

Note: I understand storing data larger than 1MB in a DB column is discouraged for performance and design reasons. I'm just wondering how I'd ever store or retrieve more than 1GB in a TEXT/BLOB if it's ever required.