tencent cloud

All product documents
Cloud Object Storage
SELECT Overview
Last updated: 2024-03-25 15:28:24
SELECT Overview
Last updated: 2024-03-25 15:28:24
The COS Select feature uses Structured Query Language (SQL) statements to filter the objects stored in COS so as to extract specific objects and get desired data. With COS Select, you can reduce the amount of data transferred by COS for lower costs and latency during data extraction.
The COS Select feature currently allows you to extract objects stored in CSV, JSON, and Parquet formats and compressed by gzip or bzip2 (for CSV and JSON objects only). In addition, you can save extraction results in CSV and JSON formats and specify how to separate the result records.
You can pass in a SQL expression to COS in your request. COS Select currently only supports certain SQL expressions. For more information, see SQL Functions.
You can use the COS console, API, SDK, or COSCMD to perform SQL queries. Note that certain limits apply to file extraction in the COS console: up to 128 MB of files can be extracted, and up to 40 MB of data can be returned. To extract more data, you need to use other methods.
Note:
For more information on data types supported by COS Select and current reserved fields, see Data Types and Reserved Fields. -Currently, the extraction function only supports public cloud regions in the Chinese mainland.

Restrictions

The following restrictions apply to COS Select:
You must have the cos:GetObject permission to the queried object. A root account has this permission by default.
Only objects in the STANDARD storage class can be extracted.
The maximum length of a SQL expression is 256 KB.
The maximum length of a single record in the extraction result is 1 MB.
SQL clauses currently supported by COS Select include:
SELECT statement
FROM clause
WHERE clause
LIMIT clause
Note:
For more information on SQL clauses, see SELECT Command.
Functions currently supported by COS Select include:
Aggregate functions, such as AVG, COUNT, MAX, MIN, and SUM.
Condition functions, such as COALESCE and NULLIF.
Conversion functions, such as CAST.
Date functions, such as DATE_ADD, DATE_DIFF, EXTRACT, TO_STRING, TO_TIMESTAMP, and UTCNOW.
String functions, such as CHAR_LENGTH, CHARACTER_LENGTH, LOWER, SUBSTRING, TRIM, and UPPER.
Note:
For more information on SQL functions, see SQL Functions.
COS Select currently supports the following operators:
Logical operators: AND, NOT, OR
Comparison operators: <, >, <=, >=, =, <>, !=, BETWEEN, IN
Pattern matching operators: LIKE
Mathematical operators: +, -, *, %
Note:
For more information on operators, see Operators.

Initiating Extraction Request

You can initiate an extraction request using the console, API, or SDK:
If you use the console, see Data Extraction.
If you use the API, see SELECT Object Content.
If you use the SDK, go to SDK Overview and select the required SDK API.

FAQs

If a problem occurs when you perform a query, COS Select will return an error code and error message. For the list of error codes and descriptions, see Special Error Codes.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon