1 comments

  • arcivanov 11 hours ago

    For the past 20+ years, MariaDB/MySQL's MEMORY (HEAP) engine has refused to store BLOB and TEXT columns entirely. This meant the optimizer was forced to spill temporary tables to disk (Aria/MyISAM) whenever a query involved JSON, TEXT, GEOMETRY, or Dynamic Columns, even when the actual data was small enough to fit in memory.

    I wrote a patch for MariaDB 10.11 that removes this limitation. The MEMORY engine can now store BLOBs natively using continuation record chains, with a zero-copy fast path for the common case of small blobs that fit in a single continuation record. Non-blob tables have zero overhead since all blob-specific code is branch-guarded.

    The practical impact: queries that use GROUP BY, DISTINCT, UNION, subquery materialization over tables with TEXT/JSON/GEOMETRY columns can now stay entirely in memory instead of hitting disk. This matters most for workloads with lots of small-to-medium temporary tables.

    Some highlights:

    - Zero-copy reads for single-run blobs (the common case in temp tables) - GEOMETRY column support (HA_CAN_GEOMETRY) - Free-list reuse with contiguous run detection to reduce fragmentation - Comprehensive test suite covering CRUD, deduplication, subquery materialization, and multi-run edge cases - No overhead for existing non-blob MEMORY tables

    Limitations: no BTREE indexes on blob columns (HASH only), no FULLTEXT (triggers conversion to Aria as before), and multi-run blobs need a temporary reassembly buffer.

    The patch is currently in review. If you run MariaDB from source or are comfortable with preview builds, I'd love for people to try it out and report any issues back on the JIRA ticket.

    Feedback, benchmarks, and bug reports all welcome.