Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share code      Blog   Popular   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
CREATE TABLE test(i int); ALTER TABLE test SET (autovacuum_enabled = off); INSERT INTO test SELECT * FROM generate_series(1,1000); -- With: Without any ANALYZE. EXPLAIN SELECT * FROM test WHERE i = 100; ANALYZE test; -- With: ANALYZE before index creation. Estimates adjusted. EXPLAIN SELECT * FROM test WHERE i = 100; CREATE INDEX ON test(i); -- With: After ANALYZE before index creation, but before ANALYZE after index creation. EXPLAIN SELECT * FROM test WHERE i = 100; ANALYZE test; -- With: ANALYZE after index creation => SAME as above. EXPLAIN SELECT * FROM test WHERE i = 100;

Stuck with a problem? Got Error? Ask ChatGPT!