3.3.57 SET TRANSACTION
Name
SET TRANSACTION -- set the characteristics of the current transaction
Synopsis
SET TRANSACTION transaction_mode
where transaction_mode is one of:
ISOLATION LEVEL { SERIALIZABLE | READ COMMITTED }
READ WRITE | READ ONLY
Description
The SET TRANSACTION command sets the characteristics of the current transaction. It has no effect on any subsequent transactions. The available transaction characteristics are the transaction isolation level and the transaction access mode (read/write or read-only). The isolation level of a transaction determines what data the transaction can see when other transactions are running concurrently:
READ COMMITTED
A statement can only see rows committed before it began. This is the default.
SERIALIZABLE
All statements of the current transaction can only see rows committed before the first query or data-modification statement was executed in this transaction.
The transaction isolation level cannot be changed after the first query or data-modification statement (SELECT, INSERT, DELETE, UPDATE, or FETCH) of a transaction has been executed. The transaction access mode determines whether the transaction is read/write or read-only. Read/write is the default.
When a transaction is read-only, the following SQL commands are disallowed: INSERT, UPDATE, and DELETE if the table they would write to is not a temporary table; all CREATE, ALTER, and DROP commands; COMMENT, GRANT, REVOKE, TRUNCATE; and EXECUTE if the command it would execute is among those listed. This is a high-level notion of read-only that does not prevent all writes to disk.
3.3.58 TRUNCATE
TRUNCATE -- empty a table
TRUNCATE TABLE name
TRUNCATE quickly removes all rows from a table. It has the same effect as an unqualified DELETE but since it does not actually scan the table, it is faster. This is most useful on large tables.
name
The name (optionally schema-qualified) of the table to be truncated.
TRUNCATE cannot be used if there are foreign-key references to the table from other tables. Checking validity in such cases would require table scans, and the whole point is not to do one.
TRUNCATE will not run any user-defined ON DELETE triggers that might exist for the table.
Truncate the table bigtable:
TRUNCATE TABLE bigtable;







