Repository navigation
Description
Problem
A table tab's page query fetches every byte of every column. TableQueryBuilder.buildBaseQuery writes SELECT * unless a column is hidden (apple/TablePro/Core/Services/Query/TableQueryBuilder.swift:85 and :211). A plugin that builds its own browse query gets the same full column list (TableQueryBuilder.swift:75). The grid then shows at most the first 64 bytes of a binary value, as hex (apple/TablePro/Extensions/String+HexDump.swift:125). A page of rows carrying megabyte blobs is slow to load and holds far more memory than the visible data needs.
The only way out today is hiding the column. A hidden column is left out of the page query (apple/TablePro/Core/Services/Query/ColumnFetchScope.swift:13, features/data-grid.mdx), but the primary key, sorted and value-filtered columns are fetched anyway, and the hidden value is no longer on screen at all.
Proposed solution
- Leave blob columns out of the page query. Select the value's byte length instead, through the dialect's own function (
OCTET_LENGTHon MySQL / MariaDB), and mark the cell as not loaded, showing its size. - Fetch the value on demand, by primary key, when the cell is opened, when its viewer or the row inspector shows it, when it is copied, and when its row goes through Export Results….
- Leave File > Export as it is: it already re-reads each table with
SELECT *(features/import-export.mdx). - Keep fetching the column inline when the table has no primary key, because the value cannot be read back by row.
- Never write an unloaded column: an edit to another cell in the row leaves it out of the UPDATE.
- A per-connection size threshold, since a small blob is cheaper to fetch inline than to fetch twice.
- Build it in the core query builder with MySQL / MariaDB first, so another SQL dialect only adds its length function. A plugin with its own browse query opts in.
Done when a page of 200 rows that each hold a 5 MB LONGBLOB loads without those bytes, opening one cell fetches only that value, and tests cover the generated query, the on-demand fetch and an edit next to an unloaded cell.
Alternatives considered
Hide the column from the columns button in the status bar, or select the columns you want by hand in a query tab instead of opening the table.
Platform
macOS
Related database type
MySQL / MariaDB
Activity