All Products
Search
Document Center

Tablestore:Does Tablestore support the IN and BETWEEN...AND operators?

Last Updated:Mar 27, 2024

If you want to perform an IN query, use one of the following methods based on your business requirements.

  • Method 1: Create a mapping table for the table and use the IN operator in the WHERE clause of the SELECT statement to query data. You can use the IN operator in Tablestore in the same manner that you use the IN operator in MySQL. The query performance when you use the IN operator in Tablestore outperforms the query performance when you use the IN operator in MySQL. For more information, see SQL operators.

  • Method 2: Create a search index for the table and use the terms query feature of the search index to query the data of a column. A terms query is equivalent to an IN query in MySQL but delivers better performance.

  • Method 3: Call the BatchGetRow operation to query data based on the complete primary key.

If you want to perform a BETWEEN...AND query, use one of the following methods based on your business requirements.