Skip to main content
From v3.5.1 onwards, the database supports connections via Apache Arrow Flight SQL protocol.

Overview

With Arrow Flight SQL protocol, you can execute normal DDL, DML, DQL statements, and use Python code or Java code to read large-scale data via Arrow Flight SQL ADBC or JDBC driver. This solution establishes a fully columnar data transfer pipeline from the database columnar execution engine to the client, eliminating the frequent row-column conversions and serialization overhead typically seen in traditional JDBC and ODBC interfaces. This enables the database to transfer data with zero-copy, low latency, and high throughput.

Scenarios

The Arrow Flight SQL integration makes the database especially well-suited for:
  • Data science workflows, where tools like Pandas and Apache Arrow expect columnar data.
  • Data lake analytics, requiring high-throughput, low-latency access to massive datasets.
  • Machine learning, where fast iteration and processing speed are critical.
  • Real-time analytics platforms, that must deliver data with minimal delays.
With Arrow Flight SQL, you can benefit from:
  • End-to-end columnar data transfer, eliminating costly conversions between columnar and row-based formats.
  • Zero-copy data movement, reducing CPU and memory overhead.
  • Low latency and extremely high throughput, accelerating analysis and responsiveness.

Technical approach

Traditionally, the database organizes query results in a columnar Block structure internally. However, when using JDBC, ODBC, or MySQL protocols, data must be:
  1. Serialized into row-based bytes on the server.
  2. Transferred over the network.
  3. Deserialized back into a target structure (often requiring re-conversion to columnar formats).
This three-step process creates:
  • High serialization/deserialization overhead.
  • Complex data transformations.
  • Latency that grows with data volume.
The integration with Arrow Flight SQL solves these issues by:
  • Retaining columnar format end-to-end, from the database execution engine directly to the client.
  • Leveraging Apache Arrow’s in-memory columnar representation, which is optimized for analytics workloads.
  • Using Arrow Flight’s protocol for high-speed transport, enabling efficient streaming without intermediate conversions.
Arrow Flight This design provides true zero-copy transmission, which is both faster and more resource-efficient than traditional methods. Additionally, the database offers a universal JDBC driver for Arrow Flight SQL, so applications can adopt this high-performance transfer path without sacrificing JDBC compatibility or interoperability with other Arrow Flight–enabled systems. For deployments where BE nodes are not directly accessible to clients (such as in private networks or Kubernetes clusters), the database provides an Arrow Flight proxy feature. When enabled, the FE can act as a proxy to route Arrow data from BE nodes to clients, maintaining the columnar transfer benefits while accommodating network topology constraints. This proxy mode incurs a small performance overhead but enables Arrow Flight SQL access in environments where direct BE connectivity is not available.

Performance Comparison

Comprehensive tests demonstrate significant improvements in data retrieval speed. Across various data types (integer, float, string, boolean, and mixed columns), Arrow Flight SQL consistently outperformed traditional PyMySQL and Pandas read_sql interfaces. Key results include:
  • For reading 10 million integer rows, execution time dropped from ~35 seconds to 0.4 seconds (~85× faster).
  • For a mixed-column table, performance improvements reached 160× acceleration.
  • Even in less complex queries (e.g., single string columns), performance gains exceeded 12×.
On average, Arrow Flight SQL achieved:
  • 20× to 160× faster transfer times, depending on query complexity and data type.
  • A clear reduction in CPU and memory usage due to the elimination of redundant serialization steps.
These performance gains translate directly into faster dashboards, more responsive data science workflows, and the ability to analyze much larger datasets in real time. For a detailed breakdown of how to reach these numbers in your client code — JDBC accessor methods, raw VectorSchemaRoot consumption, Parquet writers — and the measured speedup of each tuning step over MySQL JDBC, see Arrow Flight SQL Best Practices.

Usage

Follow these steps to connect to and interact with the database using Python ADBC Driver via Arrow Flight SQL protocol. Refer to Appendix for the complete code example. Note Python 3.9 or later is a prerequisite.

Step 1. Install libraries

Use pip to install adbc_driver_manager and adbc_driver_flightsql from PyPI:
Import the following modules or libraries into your code:
  • Required libraries:
  • Optional modules for better usability and debugging:

Step 2. Connect to the database

Note
  • If you want to start the FE service using command line, you can use the either of the following ways:
    • Specify the environment variable JAVA_TOOL_OPTIONS.
    • Specify the FE configuration item JAVA_OPTS in fe.conf. This way, you can append other JAVA_OPTS values.
  • If you want to run the service in IntelliJ IDEA, you must add the following option to Build and run in Run/Debug Configurations:

Configure the database

Before connecting to the database via Arrow Flight SQL, you must first configure the FE and BE nodes to ensure that the Arrow Flight SQL service is enabled and listening on the specified ports. In both FE configuration file fe.conf and BE configuration file be.conf, set arrow_flight_port to an available port. After modifying the configuration files, restart FE and BE services to allow the modification to take effect. Note You must set different arrow_flight_port for FE and BE. Example:

Configure Arrow Flight Proxy (Optional)

If your BE nodes are not directly accessible from client applications (for example, when deployed in private networks or Kubernetes environments), you can enable the Arrow Flight proxy feature on the FE to route data from BE nodes through the FE. The proxy feature is controlled by two global variables:
  • arrow_flight_proxy_enabled: Controls whether proxy mode is enabled. Default is true. When enabled, there is a slight performance overhead.
  • arrow_flight_proxy: Specifies the proxy hostname. If empty (default), the current FE node acts as the proxy. You can set this to a specific hostname if using a different proxy endpoint.
To configure these variables globally for all sessions:
Note
  • The proxy feature is enabled by default, which may result in 8-10% lower throughput compared to direct BE connections. If your clients have direct network access to BE nodes, or you have limited memory resources on the FE side, you can disable the proxy to achieve optimal performance: SET GLOBAL arrow_flight_proxy_enabled = false;.
  • When arrow_flight_proxy is empty, tickets will automatically route through the FE node that the client initially connected to.
  • Important: The arrow_flight_proxy and arrow_flight_proxy_enabled settings should be configured globally using SET GLOBAL. Session-level settings are not supported.
  • Session restart required: Changing the proxy settings only affects new sessions. Existing Arrow Flight SQL sessions will continue using their original settings until they reconnect.

Establish connection

On the client side, create an Arrow Flight SQL client using the following information:
  • Host address of the database FE
  • Port that Arrow Flight used for listening on the database FE
  • Username and password of the user that has the necessary privileges
A token issued by your identity provider works in place of the username and password, if a JWT or OAuth 2.0 security integration is configured. Pass it as the authorization header instead of USERNAME and PASSWORD:
The server answers the first call with a session token of its own, which the client uses for the rest of the connection, exactly as it does after a username and password. The session cannot outlive the JWT: once the token’s exp passes, the connection is refused and the client has to connect again with a new token. See Where each authentication method works. Example:
After the connection is established, you can interact with the database by executing SQL statements through the returned Cursor.

Step 3. (Optional) Predefine utility functions

These functions are used to format the output, standardize the format, and simplify debugging. You can optionally define them in your code for testing.

Step 4. Interact with the database

This section will guide you through some basic operations, such as creating a table, loading data, checking table metadata, setting variables, and running queries. Note The examples of output listed below are implemented based on the optional modules and utility functions described in the preceding steps.
  1. Create a database and a table where the data will be loaded, and check the table schema.
    Example output:
  2. Insert data, run some queries, and set variables.
    Example output:

Step 5. Close connection

Include the following section in your code to close the connection.
Example output:

Use cases of large-scale data transfer

Python

After connecting to the database (with Arrow Flight SQL support) via the ADBC Driver in Python, you can use various ADBC APIs to load the Clickbench dataset from the database into Python. Code example:
The results indicate that loading 1 million rows of Clickbench dataset (105 columns, 780 MB) from the database took only 3 seconds.

Arrow Flight SQL JDBC Driver

The Arrow Flight SQL protocol provides an open-source JDBC driver that is compatible with the standard JDBC interface. You can easily integrate it into various BI tools (such as Tableau, Power BI, DBeaver, etc.) to access the database, just as you would with a traditional JDBC driver. A significant advantage of this driver is its support for high-speed data transfer based on Apache Arrow, which greatly improves the efficiency of query and data transmission. The usage is almost identical to that of a traditional MySQL JDBC driver. You only need to replace jdbc:mysql with jdbc:arrow-flight-sql in the connection URL to seamlessly switch. The query results are still returned in the standard ResultSet format, ensuring compatibility with existing JDBC processing logic. Note Note that if you are using Java 9 or later, you must add --add-opens=java.base/java.nio=ALL-UNNAMED to your Java code to expose the internal structure of the JDK. Otherwise, you may encounter certain errors.
  • If you want to start the FE service using command line, you can use the either of the following ways:
    • Specify the environment variable JAVA_TOOL_OPTIONS.
    • Specify the FE configuration item JAVA_OPTS in fe.conf. This way, you can append other JAVA_OPTS values.
  • If you want to debug in IntelliJ IDEA, you must add the following option to Build and run in Run/Debug Configurations:
Arrow Flight Example Click here to view the POM dependencies
Code example:
Execution results:

Java ADBC Driver

The Arrow Flight SQL protocol provides an open-source JDBC driver that is compatible with the standard JDBC interface. You can easily integrate it into various BI tools (such as Tableau, Power BI, DBeaver, etc.) to access the database, just as you would with a traditional JDBC driver. A significant advantage of this driver is its support for high-speed data transfer based on Apache Arrow, which greatly improves the efficiency of query and data transmission. The usage is almost identical to that of a traditional MySQL JDBC driver. Note
  • If you want to start the FE service using command line, you can use the either of the following ways:
    • Specify the environment variable JAVA_TOOL_OPTIONS.
    • Specify the FE configuration item JAVA_OPTS in fe.conf. This way, you can append other JAVA_OPTS values.
  • If you want to debug in IntelliJ IDEA, you must add the following option to Build and run in Run/Debug Configurations:
POM dependencies
Similar to that in Python, you can also directly create an ADBC client in Java to read data from the database. In this process, you first need to obtain FlightInfo, and then connect to each Endpoint to fetch the data. Code example:

Recommendations

  • Among the three Java Arrow Flight SQL connection methods mentioned above:
    • If subsequent data analysis relies on row-based data formats, it is recommended to use jdbc:arrow-flight-sql, which returns data in the JDBC ResultSet format.
    • If the analysis can directly process Arrow format or other columnar data formats, you can use the Flight AdbcDriver or Flight JdbcDriver. These options return Arrow-formatted data directly, avoiding row-column conversion and leveraging Arrow’s features to accelerate data parsing.
  • Regardless of whether you parse JDBC ResultSet or Arrow-formatted data, the parsing time is often longer than the time spent reading the data itself. If you find that Arrow Flight SQL does not deliver the expected performance improvement over jdbc:mysql://, consider investigating whether data parsing takes too long.
  • For all connection methods, data reading with JDK 17 is generally faster than with JDK 1.8.
  • When reading large-scale datasets, Arrow Flight SQL typically consumes less memory compared to jdbc:mysql://. Therefore, if you are experiencing memory constraints, it is also worth trying Arrow Flight SQL.
  • In addition to the three connection methods above, you can also use the native FlightClient to connect to the Arrow Flight Server, enabling more flexible parallel reading from multiple endpoints. The Java Flight AdbcDriver is built on top of FlightClient and provides a simpler interface compared to using FlightClient directly.

Spark

Currently, the official Arrow Flight project has no plans to support Spark or Flink. In the future, support will be gradually added to allow starrocks-spark-connector to access the database via Arrow Flight SQL, with expected read performance improvements several times. When accessing the database with Spark, in addition to the traditional JDBC or Java client methods, you can also use the open-source Spark-Flight-Connector component to directly read from and write to the database Flight SQL Server as a Spark DataSource. This approach, based on the Apache Arrow Flight protocol, offers the following significant advantages:
  • High-performance data transfer Spark-Flight-Connector uses Apache Arrow as the data transfer format, enabling zero-copy, highly efficient data exchange. The conversion between the database’ internal Block data format and Arrow is highly efficient, achieving performance improvements of up to 10 times compared to traditional CSV or JDBC methods, and significantly reducing data transfer overhead.
  • Native support for complex data types The Arrow data format natively supports complex types (such as Map, Array, Struct, etc.), enabling better adaptation to the database’ complex data models compared to traditional JDBC methods, and enhancing data expressiveness and compatibility.
  • Support for read, write, and streaming write The component supports Spark as a Flight SQL client for efficient read and write operations, including insert, merge, update, and delete DML statements, and even supports streaming write, making it suitable for real-time data processing scenarios.
  • Support for predicate pushdown and column pruning When reading data, Spark-Flight-Connector supports predicate pushdown and column pruning, enabling data filtering and column selection on the database side, significantly reducing the amount of data transferred and improving query performance.
  • Support for aggregation pushdown and parallel read Aggregation operations (such as sum, count, max, min, etc.) can be pushed down to the database for execution, reducing the computational load on Spark. Parallel reading based on partitioning is also supported, improving read efficiency in large data scenarios.
  • Better for big data scenarios Compared to traditional JDBC methods, the Flight SQL protocol is better suited for large-scale, high concurrency access scenarios, enabling the database to fully leverage its high-performance analytical capabilities.

Appendix

The following is the complete code example in the usage tutorial.