Running Queries
Yellowbrick supports ANSI SQL queries, with support for a large set of SQL functions, including window functions, and pattern matching with POSIX regular expressions. For details, see SQL Functions and Operators. You can also use prepared statements.
Yellowbrick supports the following commands for submitting queries:
- SELECT
- SELECT INTO
- TABLE
- CREATE TABLE AS (CTAS)
- PREPARE, EXECUTE, DEALLOCATE (prepared statements)
For detailed syntax, see SQL Commands.
Transaction Blocks
You can run queries and other SQL commands within transaction blocks by using standard BEGIN and END statements. You can also create savepoints within transactions and roll back to these savepoints.
By default, when BEGIN and END statements are not used, Yellowbrick executes transactions in "autocommit" mode; each statement is executed in its own transaction and an implicit commit occurs at the end of the statement (assuming that execution was successful).
The only transaction isolation level that Yellowbrick supports is read committed
.
Restrictions
Note the following restrictions on Yellowbrick queries:
- You can run read queries across physical databases, but you cannot write to remote databases. See Cross-Database Queries.
- You cannot run queries against a mixture of user-defined tables and system tables or views. One exception to this rule is the sys.const table, which can be queried in conjunction with regular tables.
- You cannot create a table by selecting from PostgreSQL system catalog tables.
Recording and Playing Back Queries in the SMC
Administrators can use the Query Analysis feature in the SMC to record the progress of a query and play it back for analysis.
- Go to Monitor > Query Performance and select a query. On the Query Details screen, click Analyze, then Execute and Record.
- The analysis will be recorded as the query runs.
- Play back the query recording by clicking the play icon in the bottom-left corner of the Query Analysis screen. For example:
Note: The Query Analysis feature is not supported with Firefox Private Browsing.
Parent topic:Database Administration