Q1
True / FalseThe TRUNCATE command in PostgreSQL can be used to remove all rows from a table without logging individual row deletions.
The TRUNCATE command removes all rows from a table quickly by not logging individual row deletions, making it faster than DELETE for large tables.
Q2
True / FalseThe TRUNCATE command in PostgreSQL can be rolled back if it is part of a transaction.
The TRUNCATE command is transaction-safe in PostgreSQL and can be rolled back if it is part of an open transaction.
Q3
True / FalseThe TRUNCATE command can only be used on a single table at a time in PostgreSQL.
PostgreSQL allows TRUNCATE to be used on multiple tables at once by specifying a comma-separated list of table names.
Q4
True / FalseThe TRUNCATE command will not fire any ON DELETE triggers defined on the table.
TRUNCATE bypasses ON DELETE triggers because it does not delete rows individually.
Q5
True / FalseIn PostgreSQL, using TRUNCATE on a table with foreign key references from other tables will succeed without any additional steps.
You must use the CASCADE option with TRUNCATE if the table being truncated has foreign key references to ensure that the referencing tables are also truncated or the constraints are temporarily disabled.
Q6
True / FalseThe TRUNCATE command resets any sequences associated with the table's columns back to their starting values.
By default, TRUNCATE does not reset sequences. To reset sequences, you must use the RESTART IDENTITY option.
Q7
True / FalseTRUNCATE in PostgreSQL can be restricted by using a WHERE clause to limit the rows that are removed.
The TRUNCATE command does not support a WHERE clause. It removes all rows from the specified tables.
Q8
True / FalseTRUNCATE is a part of Data Definition Language (DDL) in PostgreSQL.
TRUNCATE is considered a DDL command because it changes the structure of the table by removing all rows efficiently.
Q9
True / FalseThe TRUNCATE command requires more locks compared to the DELETE command in PostgreSQL.
TRUNCATE requires fewer locks and takes a shorter time compared to DELETE, especially on large tables, because it does not log individual row deletions.
Q10
True / False: In PostgreSQL, using TRUNCATE on a partitioned table will not affect its partitions.
When TRUNCATE is used on a partitioned table, it will affect all its partitions by removing rows from each partition.