Differences between using the GetRange and Search APIs for range queries

Updated at:

Difference

GetRange API

Search API

Real-time query performance

Queries run directly on the data table without needing an index. Data can be queried as soon as it is written.

For more information about the GetRange API, see Read data and GetRange.

Queries run on a search index. The search index and the data table synchronize asynchronously. After data is written, you must wait for synchronization to finish before you can query the data. Synchronization usually completes within 3 seconds.

For more information about the Search API, see Introduction to Search Index and Search.

Computing resource consumption and scalability

The system locates data table partitions based on the specified timestamp range. Read operations run only in these partitions. This process consumes few computing resources and is scalable.

Computing resource consumption and scalability vary depending on whether you specify a routing key when you create the search index.

  • If you do not specify a routing key, the system performs read operations on all partitions. This consumes more computing resources and offers limited scalability.

  • If you specify a routing key, the system locates the specific partitions to perform read operations. This consumes fewer computing resources. The query capability can be extended based on the number of partitions. However, index partitions do not support dynamic splitting, so dynamic scalability is not supported.

For more information about how to create a search index, see Create a search index.

Data filtering support

Performs only data scans and does not support complex data filtering.

Supports filtering by any combination of column conditions for greater flexibility.