Table Operations
Analyze, optimize, check, repair, vacuum, and truncate without writing the statements.
The submenu runs maintenance statements on the selected tables. It's in the primary sidebar's contextual menu, the Table Content view's contextual menu, and the menu.
Operations can take a long time to finish, so they run as background tasks with a progress panel and can be applied to several tables at once. You can tell Querious to "Stop Waiting" if you want to move onto other tasks while the server finishes.
MySQL #
| Operation | Statement | Use it to |
|---|---|---|
| Analyze | ANALYZE TABLE |
Recompute the key statistics the optimizer uses to choose a plan. Try this first when a query stops picking a good index. |
| Check | CHECK TABLE |
Look for errors. Read-only; it reports problems without fixing them. |
| Optimize | OPTIMIZE TABLE |
Reclaim space and defragment, such as after deleting a large fraction of rows. |
| Repair | REPAIR TABLE |
Attempt to fix a damaged table. MyISAM and a few other engines only; InnoDB has its own recovery. |
| Flush | FLUSH TABLE |
Close and reopen the table, flushing its cached copy. |
| Truncate… | TRUNCATE TABLE |
Remove every row. Asks first, and offers Ignore Foreign Key Constraints for tables other tables reference. |
PostgreSQL #
| Operation | Statement | Use it to |
|---|---|---|
| Analyze… | ANALYZE |
Update the planner's statistics. |
| Vacuum… | VACUUM |
Reclaim space from dead tuples. The confirmation offers Full Vacuum (VACUUM FULL). |
| Truncate… | TRUNCATE |
Remove every row. |
Materialized views have their own refresh controls in the Structure view. Refreshing re-runs the query and repopulates it; clearing its data leaves it defined but empty.
Recipes #
To empty a table that other tables reference
-
Choose .
-
If it's refused because of references, turn on Ignore Foreign Key Constraints.
-
Make sure the referencing rows are going too, or they'll be left pointing at nothing.
To reclaim space after deleting many rows
-
Note the table's size in Table Info.
-
On MySQL run Optimize. On PostgreSQL run Vacuum, adding Full Vacuum only if you can afford the exclusive lock.
-
Check the size afterwards.
To fix a query that suddenly chooses a bad plan
-
Confirm the plan with Explain Query in the query editor.
-
Select the tables involved and choose .
-
Explain again. Stale statistics after a large data change are a common cause.