Using a bad
atquery to export/dump data from the Sensage database to a CSV file can result in a timeout or processes being killed.
(This article assumes you are running an ad-hoc (SQL) query report using the
atquery instead of using the Analyzer's reporting features.)
The user is most likely using a sub-optimal
atquery that is exporting a lot of unnecessary data and not allowing the query to execute within a reasonable time frame.
atquery --help can help you understand the full usage of the atquery and its options.
To optimize the
- Don't forget to specify the format you want to save the report in. If it's a CSV file, use
- Add the
--verbose=1option to avoid showing unnecessary data.
- Specify a time range to limit data. For example, if you need to export data from a single day, you should use a
DURINGclause to limit the query to the desired time range. This could look like this:
SELECT * FROM example_table DURING _time('Jan 31 00:00:00 2020'),_time('Jan 31 23:59:59 2020'). See page 373 of the Reporting Guide in the Information section below to find the usage of the
- Do NOT use a
WHEREclause on a specific field to filter data by time as it is going to go over the entire table to export even a single day and that will take forever. Replace the
WHEREclause with a
DURINGclause to narrow down the time range as explained above.
- Use the
SELECTstatement to select only the data fields that are needed.
Prior knowledge of SQL and Sensage SQL syntax is needed here. For helpful documentation see the Information section.
Following these recommendations should let the query execute without timing out.
For help on reporting, Sensage SQL syntax, and other user guides, refer to the following: