Updated on 2025-09-04 GMT+08:00

Architecture Principles

Core Principles

Figure 1 Principles of streaming query
  • When a streaming query is executed, the server keeps sending data to the client's socket buffer until the buffer is full. Upon the arrival of the first data record in the buffer, the first D packet is returned. JDBC then begins loading and processing data from the buffer row by row.
  • The result set is designed to store only one row of data. The next data record is read from the buffer and stored into the result set only when the "next" method is called. This process repeats until all records have been read.

Solution Advantages

Streaming query is recommended for big data query scenarios with limited memory resources. If streaming query does not meet your service requirements, consider the following alternative methods:

  • Standard query: All data is read in one go.

    Advantages: This method allows traversal of the entire result set in both forward and backward directions. In addition, data can be reprocessed after being consumed.

    Disadvantages: Processing is slow, and there is a risk of memory overflow with large result sets.

  • Batch query: Multiple rows are read at a time. For details, see Batch Query.

    Advantages: Data is returned in the specified size, which helps prevent memory overflow.

    Disadvantages: Processing is slow, and multiple query requests need to be sent to the server.