EXPLAIN ANALYZE
EXPLAIN ANALYZE is a SQL statement in the PostgreSQL Specific category. Executes the query and shows the actual execution plan WITH timing and row counts. Invaluable for performance tuning. The syntax is EXPLAIN ANALYZE SELECT ...;. It returns execution plan with timing. A typical example: EXPLAIN ANALYZE SELECT * FROM employees WHERE last_name = 'Smith'; -- Shows: -- Seq Scan on employees (cost=0.00..12.40 rows=1 width=36) -- Filter: (last_name = 'Smith'::text) -- Planning Time: 0.045 ms -- Execution Time: 0.082 ms A close relative is SERIAL, which postgreSQL auto-increment type. Creates an INTEGER column with a sequence. Equivalent to AUTO_INCREMENT in MySQL. A close relative is RETURNING, which postgreSQL extension that returns values from INSERT/UPDATE/DELETE statements (like OUTPUT in SQL Server). A close relative is ARRAY, which postgreSQL supports array columns and array operations. Can be multi-dimensional. More about this category: PostgreSQL-specific features — SERIAL, RETURNING, ARRAY, JSONB, UPSERT.