Overall Performance
Two comparisons follow. The first measures only the protocol fetch — how long it takes for the bytes to arrive and be parsed, with no language-level object conversion. The second measures a real-world Python application where data is read into apandas DataFrame. See Test Environment for the hardware.
Protocol-level fetch (Arrow Flight ADBC vs mysql --quick)
fetch_arrow_table() drains the network into Arrow buffers without converting cells into Python objects. mysql --quick drains the MySQL wire protocol with a streaming C client that parses rows. Both are protocol-only — neither pays for language-native object materialization.
Real-world Python application — pd.read_sql with ADBC vs PyMySQL
The canonical Python pipeline is pd.read_sql(sql, conn) → pandas.DataFrame. The connection object you hand it is the entire migration: pass a PyMySQL Connection and pandas calls cursor.fetchall() + pd.DataFrame(rows), walking every row to build the DataFrame. Pass an ADBC Flight SQL connection and pandas uses ADBC’s native Arrow fetch + near-zero-copy DataFrame conversion.
Each cell is fetch + convert = total; the speedup is total vs total. Narrow numeric queries hit the largest ratio because the PyMySQL side allocates a Python
int per cell during fetch and pandas then walks the tuple list during conversion — the ADBC side skips both costs. Arrow’s columnar memory format wins twice: it skips per-cell Python object allocation during fetch, and makes the DataFrame conversion almost free afterwards.
If your existing code already uses pd.read_sql, the migration is one line:
Test Environment
Choosing a Client
Before any code-level tuning, the biggest single decision is which client API you read results through. Interact with the database via Arrow Flight SQL covers the full setup for Python ADBC, the Arrow Flight JDBC driver, the Java ADBC driver, and the nativeFlightClient. For performance, those collapse into two paths:
- Raw Arrow batches via
FlightSqlClientor ADBC (recommended). This is the columnar end-to-end path the Flight SQL protocol is designed for: your code receivesVectorSchemaRootbatches and reads them with primitive-returning vector accessors, with no per-row object allocation. End-to-end (drain + typed conversion), this path is about 10× faster than Java MySQL JDBC on 10 M numeric rows, and up to 97× faster than PyMySQL on 100 M narrow numeric queries delivered as a pandas DataFrame. Use it whenever your downstream code can consume columnar data (Pandas, Arrow, ML pipelines, Parquet writers, custom analytics). - Arrow Flight JDBC driver (
jdbc:arrow-flight-sql). Use this when you need a drop-inResultSetfor an existing JDBC code path, or for BI tools like Tableau, Power BI, and DBeaver where the JDBC interface is required. JDBC’s API forces the driver to return a boxedObjectfor every cell, so this path cannot reach the performance of raw Arrow batches. The JDBC driver is still substantially faster than MySQL JDBC; it is the right tool when JDBC compatibility is the requirement.
SELECT * takes ~22 s through Java MySQL JDBC versus ~105 s through PyMySQL — so the Java ratios you’ll see are smaller than the Python numbers in Overall Performance. Java MySQL JDBC is the right baseline when you are choosing between Java drivers.
The four aspects below apply within whichever client you choose: Aspect 1 is for JDBC consumers, Aspects 2–3 are for raw-batch consumers, and Aspect 4 covers Parquet output from either.
What Affects Performance
The speedups above assume the client code is written for Arrow. The following four aspects each move the needle by 2× or more on the right workload. Getting them right is the difference between the “tuned” column in the table above and a fetch that looks no faster than MySQL.- JDBC accessor method. Use
rs.getObject(i)with a typed cast for numeric columns.rs.getString(i)forces the driver to format every value as a string. - Vector resolution scope. When consuming raw
VectorSchemaRootbatches, resolve eachFieldVectoronce per batch outside the row loop, not once per row. - Typed
.get(i)for numerics. On numeric vectors, the typed.get(i)returns a primitive with no allocation. The generic accessors box every value. - Parquet writer choice. PyArrow writes Parquet directly from the Arrow stream with no row-by-row code. Java has no pre-built library for this — every Java path requires a hand-written
WriteSupport<VectorSchemaRoot>on top ofparquet-hadoop.
Aspect 1 — JDBC: Use Typed Column Access
When using the Arrow Flight JDBC driver, users.getObject(i) and cast to the expected Java type. This lets the driver return the native Java type directly without an extra conversion step, which matters most for numeric columns.
Benchmark: JDBC Accessor Methods (includes network)
Aspect 2 — Raw Arrow Batches: Pre-Resolve Vectors and Use Typed Access
When consuming raw Arrow batches via the nativeFlightSqlClient (i.e., iterating over VectorSchemaRoot objects), follow two rules.
Resolve vectors once per batch, not once per row. Call root.getVector("column_name") before the row loop so the lookup cost is paid once per batch rather than once per row.
Use typed .get(i) for numeric vectors. This returns a primitive value directly — no heap allocation, no GC pressure.
Benchmark: Arrow Batch Conversion Cost (pre-fetched)
The Arrow Flight numbers below isolate the conversion cost: batches are drained from the cluster into memory first, then timed.Aspect 3 — Writing Results to Parquet
Apache Arrow does not include a pre-built Parquet writer forVectorSchemaRoot. If your goal is simply to export query results to Parquet files, INSERT INTO FILES lets the database write the files server-side without any client-side conversion code. The options below apply when you need client-side Parquet output via Arrow Flight.
Option 1: Python with PyArrow (Recommended)
PyArrow handles the Arrow → Parquet conversion with no custom write logic. It preserves column types natively (INT32, INT64, TIMESTAMP_MICROS, etc.). Streaming batch-by-batch from Arrow Flight:Option 2: Java WriteSupport
For Java, build a customWriteSupport<VectorSchemaRoot> on top of org.apache.parquet:parquet-hadoop. Build the schema and writer once per job, then use typed vector reads inside WriteSupport.write().
Build schema and writer once:
WriteSupport.write():
Parquet Benchmark
Numbers include both Parquet encoding and file I/O cost (see Test Environment). VARCHAR and numeric tables are benchmarked separately because they stress different parts of the Arrow encoding path: VARCHAR columns require offset-buffer arithmetic on variable-length data, while numeric columns use fixed-width typed vectors where the gains from typed access are much larger.Java (5 M and 10 M rows)
Both rows use the sameparquet-hadoop write path (MySqlParquetConverter + arrow-jdbc adapter, batch size 65,536) so the only variable is the inbound JDBC driver.
Python (PyArrow 24.0.0 / ADBC 1.11.0)
The MySQL baseline is the same Java MySQL JDBC → Parquet number from the table above; “MySQL → PyArrow” is not a real path because there is no MySQL → Arrow adapter outside ofarrow-jdbc. Python numbers were collected at 5 M only.
PyArrow adds almost no overhead on top of the raw network fetch and requires far less code than the Java path. Use PyArrow unless Java is a hard requirement.