Few Bytes, Many Requests: Migrating 100,000 Small Tables A GreptimeDB engineering benchmark of 100,000 small logical tables (3.2 million rows, roughly 198 MiB) cut export time from 51 minutes to 25 seconds and restore time from nearly two hours to 29 seconds by eliminating per-table fixed costs, reducing S3 HTTP requests from 700,315 to 42 for export and 32 for restore. The baseline restore issued 600,204 S3 requests — 204 for directory listing, manifest and DDL reads plus 6 per table — traced through GreptimeDB's Parquet COPY reader, the parquet crate and OpenDAL, with three separate stat() HEAD calls and two backward-seek GETs per file. The 15-PR implementation in GreptimeDB issue #9120 follows the Export/Import v2 RFC, which had already moved chunk scheduling and snapshot reads to COPY DATABASE over file:// or s3:// URIs. In a benchmark of 100,000 small tables in GreptimeDB 3.2 million rows total, roughly 198 MiB uploaded , exporting to MinIO with 100 ms of injected latency per request took 51 minutes, restoring took nearly two hours, and the two phases together sent 700,315 S3 HTTP requests. On the same dataset and the same hardware, the redesigned path finished export in 25 seconds and restore in 29 seconds, using 42 and 32 requests. I published the user-facing walkthrough and CLI examples on the Greptime blog https://greptime.com/blogs/2026-12-02-greptimedb-export-import-v2 . This post covers the storage and systems side: why table count overwhelmed data size, how eliminating each per-table fixed cost shifted the bottleneck somewhere else, what broke on wide schemas, and what I ended up cutting from my own RFC. The 15-PR implementation in 9120 https://github.com/GreptimeTeam/greptimedb/issues/9120 was also one of the storage tracks I ran through my Tech Lead AI workflow https://fengjiachun.github.io/posts/tech-lead-ai-workflow/ . Why 100,000 Tables In observability workloads, it is common to map every Prometheus metric name to its own table. GreptimeDB’s Metric Engine handles that without creating 100,000 separate storage partitions regions by multiplexing many logical tables onto a few physical tables . A physical table holds one timestamp column, one numeric value column, internal columns such as table id , and the union of all string tag columns across the logical tables sharing it. Each logical table exposes only the tag columns it actually uses. That layout makes ingestion and storage metadata cheap, so a single database can easily accumulate 100,000 small logical tables holding only a few GiB of data. Users in Discussion 7394 https://github.com/orgs/GreptimeTeam/discussions/7394 reported exports taking days at that scale. Export/Import v2 RFC https://github.com/GreptimeTeam/greptimedb/blob/main/docs/rfcs/2025-12-30-export-import-v2.md had already fixed the outer shell: the CLI schedules time-windowed chunks and tracks progress, while the source and target servers read and write snapshots directly through COPY DATABASE over a standard file:// or s3:// URI. What v2 did not fix was what happened inside each chunk. Every logical table still paid its own per-table tax. Where the Time Went When total data is ~200 MiB, bandwidth is irrelevant. Wall-clock time is roughly: tables × requests per table × round trip latency In the baseline restore of 100,000 tables, explicit-file COPY 9126 https://github.com/GreptimeTeam/greptimedb/pull/9126 had already removed per-table directory listing, yet GreptimeDB still issued 600,204 S3 requests: 204 for directory listing pages and reading the manifest and DDL files, plus 6 requests per table. Tracing the restore path through GreptimeDB’s Parquet COPY reader, the parquet crate, and OpenDAL shows where each one went: | | Method | Where it came from | |---|---|---| | 1 | HEAD | File check calls stat to verify the explicit input path is a regular file | | 2 | HEAD | Metadata loader calls stat a second time to get the file length | | 3 | GET | Parquet metadata reader with no prefetch hint reads the last 8 bytes for the footer length | | 4 | GET | Seeks backwards to read the Thrift footer; OpenDAL’s async reader only reuses buffered bytes on forward seeks, so seeking back triggers a new GET | | 5 | HEAD | Stream builder calls stat a third time before opening the data reader | | 6 | GET | Stream builder opens a 256 KiB chunked reader and fetches the rest of the ~2 KiB file on the first column; remaining columns seek forward inside that buffer | It also explains why the narrow 4-column and wide 12-column benchmark fixtures described below issued the exact same 600,204 restore requests. As long as a small table fits inside the 256 KiB read chunk, per-table request count is independent of column width. Even with both duplicate HEAD s gone and the footer fetched in one read, each file still costs three requests: 300,000 in total. The floor is one GET per file, 100,000 requests, and at 100 ms each that is still tens of minutes. The export baseline was already tight: conditional object creation 9296 https://github.com/GreptimeTeam/greptimedb/pull/9296 had removed the per-file HEAD , leaving about one PUT per table 100,111 requests , and export still took 51 minutes. We had to stop paying per table at every stage: scanning, storing, reading, and creating tables. One Scan per Physical Table Instead of planning and running 100,000 queries, the exporter groups selected logical tables by their underlying physical table and issues one query per physical table per chunk: SELECT table id, ts,