You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.7 KiB
ReStructuredText

==============
System ops
==============
2 years ago
.. module:: SysOp
:noindex:
2 years ago
System ops start with a double-colon ``::`` and must appear alone in a script.
2 years ago
In the following, we explain what each system op does, and the arguments they expect.
2 years ago
2 years ago
--------------
Explain
--------------
.. function:: ::explain { <query> }
2 years ago
A single query is enclosed in curly braces. Query options are allowed but ignored.
The query is not executed, but its query plan is returned instead.
Currently, there is no specification for the return format,
but if you are familiar with the semi-naïve evaluation of stratified Datalog programs
2 years ago
subject to magic-set rewrites, the returned data is pretty self-explanatory.
2 years ago
----------------------------------
Ops on stored relations
----------------------------------
.. function:: ::relations
2 years ago
List all stored relations currently in the database
2 years ago
.. function:: ::columns <REL_NAME>
2 years ago
List all columns for the stored relation ``<REL_NAME>``.
2 years ago
.. function:: ::remove <REL_NAME> (, <REL_NAME>)*
2 years ago
Remove stored relations. Several can be specified, joined by commas.
2 years ago
2 years ago
.. function:: ::rename <OLD_NAME> -> <NEW_NAME> (, <OLD_NAME> -> <NEW_NAME>)*
2 years ago
2 years ago
Rename stored relation ``<OLD_NAME>`` into ``<NEW_NAME>``. Several may be specified, joined by commas.
2 years ago
2 years ago
.. function:: ::show_triggers <REL_NAME>
2 years ago
2 years ago
Display triggers associated with the stored relation ``<REL_NAME>``.
2 years ago
.. function:: ::set_triggers <REL_NAME> <TRIGGERS>
2 years ago
2 years ago
Set triggers for the stored relation ``<REL_NAME>``. This is explained in more detail in the transactions chapter.
2 years ago
2 years ago
.. function:: ::access_level <REL_NAME> <ACCESS_LEVEL>
Sets the access level of ``<REL_NAME>`` to the given level. The levels are:
* ``normal`` allows everything,
* ``protected`` disallows ``::remove`` and ``:replace``,
* ``read_only`` additionally disallows any mutations and setting triggers,
* ``hidden`` additionally disallows any data access (metadata access via ``::relations``, etc., are still allowed).
It is recommended to give the appropriate access levels to tables to prevent data loss from programming mistakes.
2 years ago
------------------------------------
Monitor and kill
------------------------------------
.. function:: ::running
2 years ago
Display currently running queries and their IDs.
.. function:: ::kill <ID>
Kill a running query specified by ``<ID>``. The ID may be obtained by ``::running``.
------------------------------------
2 years ago
Maintenance
------------------------------------
2 years ago
.. function:: ::compact
Run compaction on the database. Running this may make the database smaller on disk and faster for queries,
but running the op itself may take some time in the background.