Easily unlock SQL debugging skills and common problem location

Honghu is based on SQL queries for data analysis. During use, you may find that the written SQL queries have no data or are inconsistent with the expected data results. Here are some tips for reference:

View time range

Honghu will reduce the amount of data query based on the time range of the query page. If the expected data results are not found, the first step to confirm is whether the query time range is correct. The time range here contains two parts:

Query the time range of the page, including relative time/absolute time/time zone and other information

The time range specified in the SQL query, such as _time > '2022-09-05T08:28:31+00:00'

Make sure the underlying query has data

If the query is based on a data set, you can first confirm whether there is data in the data set

You can view the number of data through the data set management page

You can view the data in the data set through SQL

If the query analysis statement is based on a table function, check whether the underlying table function returns the expected data

Dismantling SQL step-by-step verification

If the query is relatively complex, such as defining a CTE and then adding a JOIN operation, the final search results will be inconsistent with expectations. In this case, you can first disassemble the SQL query and verify it step by step.

For example, first make sure that the results of the CTE search are expected, then verify the JOIN results, and finally find the possible problems.

View query error log

You can view the query log of the corresponding query task through the query task page.

Add filter conditions to the opened query page: log_level = 'error'

Guess you like

Origin blog.csdn.net/Yhpdata888/article/details/131403382