SQL runner and clearing the cache

The super administrator's tools: running and saving queries, reversible data changes with the undo log, and clearing the cache and temporary files from the header.

With the SQL runner the super administrator can query the database directly and make narrow, reversible changes. The broom icon in the header clears the cache and temporary files. Both tools are available to the super administrator only.

Running a query

  1. Open System → SQL runner.
  2. Type the query into SQL query and click Run. Clear empties the field.
  3. The result appears as a table with at most 500 rows. Use the copy button to paste the whole result (tab-separated, with header) into Excel.
  4. For a frequent query enter a Name and click Save new. Later you can load, overwrite or delete it from the Saved query selector.

Reversible changes

  1. Type an update statement for a single table, with a required condition.
  2. Click Run: the system first only counts how many rows would be affected.
  3. After confirmation it runs the change, saving the original values first. At most 2000 rows can be changed at once.
  4. In Undo log (UPDATE runs) click Restore the original values in the change's row to put the old values back. Rows changed again or deleted since then are skipped and listed.
Only read-only statements (query, structure display, execution plan) and the narrow change above are allowed; only one statement can run at a time. Every run, including rejected ones, is logged.

Clearing the cache and temporary files

  1. Click the broom icon in the header.
  2. Confirm: "Clear the cache and remove orphaned temporary files? Files belonging to an upload or an import that is still running are kept."
  3. The system reports how many template, query cache and temporary files were removed, how much space was freed and how many files were kept because of a running operation.

Only temporary files older than 6 hours are removed; files of uploads in progress and of running iPhone backup processing are protected.

Example

The administrator notices that a partner name was entered wrongly on several hundred invoices. They fix it with a change: Run first reports 312 affected rows, and after confirmation runs it. It turns out the condition was wrong; in the Undo log one click restores the original values.

Related topics: sql query cache maintenance