All Products
Search
Document Center

Simple Log Service:Completely accurate SQL mode

Last Updated:Mar 25, 2026

This topic describes how the completely accurate mode works and how to use it.

Limitations

The completely accurate mode is not supported for the following features:

How it works

The completely accurate mode guarantees precise results by trading longer execution time for more computing resources. It converts various resource constraints, such as I/O and CPU, into a single time-based limit. If a query encounters a resource limit, the system throttles it to a sustainable rate instead of terminating it, allowing it to run to completion or until the timeout is reached. This mode uses strategies such as task allocation in isolated resource pools, user-based queue prioritization, and load balancing to ensure efficient resource scheduling.

image

As shown in the following figure, standard queries run in a standard compute pool. If a query hits a resource limit, it is immediately truncated, leading to inaccurate results. When you enable the completely accurate mode, the query runs in a dedicated accurate compute pool. Even if it encounters resource limits, the system ensures the task continues to run at a sustainable rate until all data is loaded and the computation is complete.

image

Prerequisites

Procedure

Simple Log Service allows you to enable the completely accurate mode for individual query and analysis operations within a specific Logstore.

Note

You can set the maximum timeout for completely accurate mode via the console, API, or SDK. The maximum timeout for an analytic statement is 55 seconds.

Console

  1. Log on to the Simple Log Service console.

  2. In the Projects section, click the one you want.

    image

  3. On the Log Storage > Logstores tab, click the logstore you want.

    image

  4. Click image > Completely Accurate.

    Important

    You can adjust the timeout by setting the query_max_run_time parameter.

    For example, if your analytic statement is * | select count(*) as pv, you can add set session query_max_run_time=10s; to the statement. The full analytic statement becomes * | set session query_max_run_time=10s; select count(*) as pv .

    image

API

  • GetLogs (returns uncompressed results) - Queries log data in a Logstore

    • Parameter: query

      For example, the analytic statement is * | select count(*) as pv.

      • Enable completely accurate mode: Prepend set session allow_incomplete=false; to your analytic statement. For example, * | select count(*) as pv becomes * | set session allow_incomplete=false; select count(*) as pv .

      • Set the query analysis timeout: Add set session query_max_run_time=10s; to the analysis statement. This sets the maximum execution time to 10s. The analysis statement is: * | set session allow_incomplete=false; select count(*) as pv .

      • To enable completely accurate mode and set a timeout, prepend the session commands to your analytic statement. For example: * | set session allow_incomplete=false; set session query_max_run_time=10s;select count(*) as pv .

  • GetLogsV2 (returns compressed results) - Queries log data in a Logstore

    • Parameter: query

      For example, the analytic statement is * | select count(*) as pv.

      • Enable completely accurate mode: Prepend set session allow_incomplete=false; to your analytic statement. For example, * | select count(*) as pv becomes * | set session allow_incomplete=false; select count(*) as pv .

      • Set the query analysis timeout: Add set session query_max_run_time=10s; to the analysis statement. This sets the maximum execution time to 10s. The analysis statement is: * | set session allow_incomplete=false; select count(*) as pv .

      • To enable completely accurate mode and set a timeout, prepend the session commands to your analytic statement. For example: * | set session allow_incomplete=false; set session query_max_run_time=10s;select count(*) as pv .

SDK

This section uses the Simple Log Service SDK for Java as an example.

Prerequisites

You have installed the Simple Log Service SDK for Java. For more information, see Install the Simple Log Service SDK for Java.

  • GetLogs() method

    • Parameter: query

      For example, the analytic statement is * | select count(*) as pv.

      • Enable completely accurate mode: Prepend set session allow_incomplete=false; to your analytic statement. For example, * | select count(*) as pv becomes * | set session allow_incomplete=false; select count(*) as pv .

      • Set the query analysis timeout: Add set session query_max_run_time=10s; to the analysis statement. This sets the maximum execution time to 10s. The analysis statement is: * | set session allow_incomplete=false; select count(*) as pv .

      • To enable completely accurate mode and set a timeout, prepend the session commands to your analytic statement. For example: * | set session allow_incomplete=false; set session query_max_run_time=10s;select count(*) as pv .

    • Parameter: session

      • Enable completely accurate mode: request.SetSession("allow_incomplete=false");.

      • Set the query timeout: request.SetSession("query_max_run_time=10s"); .

      • Enable completely accurate mode and set a timeout: request.SetSession("allow_incomplete=false;query_max_run_time=10s").

    import com.aliyun.openservices.log.Client;
    import com.aliyun.openservices.log.exception.LogException;
    import com.aliyun.openservices.log.request.GetLogsRequest;
    import com.aliyun.openservices.log.response.GetLogsResponse;
    
    public class CrearteLogStore {
        public static void main(String[] args) throws LogException {
            // This example obtains the AccessKey ID and AccessKey Secret from environment variables.
            String accessId = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID");
            String accessKey = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET");
            // Set the endpoint for Simple Log Service. This example uses the endpoint for the China (Beijing) region. Replace it with your actual endpoint.
            String host = "https://cn-beijing.log.aliyuncs.com";
            // Create a Simple Log Service client.
            Client client = new Client(host, accessId, accessKey);
            // Specify the Project name.
            String projectName = "aliyun-test-project";
            // Specify the Logstore name.
            String logstore = "request_log";
            String query = "* | SELECT count(0)";
            int from = (int)(System.currentTimeMillis()/1000) - 60;
            int to = (int)(System.currentTimeMillis()/1000);
            GetLogsRequest request = new GetLogsRequest(projectName, logstore, from, to, "", query);
            request.SetSession("allow_incomplete=false;query_max_run_time=10s");
            GetLogsResponse response = client.GetLogs(request);
            System.out.println(response.getCpuSec());
        }
    }

FAQ

  • How do I check the CPU time?

    After you run a query and analysis, hover over Analysis Results to view the CPU time, as shown in the following figure.计费

  • What are the fees for a single use of Dedicated SQL?

    The fees for Dedicated SQL vary based on the data volume and the query and analysis statements that you run. The following table provides examples.

    Query and analysis statement

    Data volume (rows)

    Average cost per execution (/USD)

    * | select avg(double_0) from stress_s1_mil1

    4 billion

    0.004435

    * | select avg(double_0), sum(double_0), max(double_0), min(double_0), count(double_0) from stress_s1_mil1

    4 billion

    0.006504

    * | select avg(double_0), sum(double_1), max(double_2), min(double_3), count(double_4) from stress_s1_mil1

    4 billion

    0.013600

    * | select key_0 , avg(double_0) as pv from stress_s1_mil1 group by key_0 order by pv desc limit 1000

    4 billion

    0.011826

    * | select long_0, avg(double_0) as pv from stress_s1_mil1 group by long_0 order by pv desc limit 1000

    4 billion

    0.011087

    * | select long_0, long_1, avg(double_0) as pv from stress_s1_mil1 group by long_0,long_1 order by pv desc limit 1000

    300 million

    0.010791

    * | select avg(double_0) from stress_s1_mil1 where key_0='key_987'

    4 billion

    0.00007