Created
October 18, 2012 10:49
-
-
Save anarazel/3910956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Session 1: | |
DROP TABLE IF EXISTS test_drop_concurrently ; | |
CREATE TABLE test_drop_concurrently(id serial primary key, data int); | |
INSERT INTO test_drop_concurrently(data) SELECT * FROM generate_series(1, | |
100); | |
CREATE INDEX test_drop_concurrently_data ON test_drop_concurrently(data); | |
SET enable_seqscan = false; | |
PREPARE getrow_idx AS SELECT * FROM test_drop_concurrently WHERE data = 34; | |
PREPARE getrow_seq AS SELECT * FROM test_drop_concurrently WHERE data::text = 34::text; | |
BEGIN; | |
EXPLAIN (ANALYZE, COSTS off) EXECUTE getrow_idx; | |
EXPLAIN (ANALYZE, COSTS off) EXECUTE getrow_seq; | |
(1 row) | |
Session 2: | |
BEGIN; | |
SELECT * FROM test_drop_concurrently WHERE data = 34; | |
Session 3: | |
DROP INDEX CONCURRENTLY test_drop_concurrently_data; | |
(in-progress) | |
Session 2: | |
INSERT INTO test_drop_concurrently(data) SELECT * FROM generate_series(1, | |
100); | |
COMMIT; | |
Session 1: | |
EXPLAIN (ANALYZE, COSTS off) EXECUTE getrow_idx; | |
EXPLAIN (ANALYZE, COSTS off) EXECUTE getrow_seq; | |
(2 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment