CREATE TABLE dupindexcols AS
SELECT unique1 as id, stringu2::text as f1 FROM tenk1;
CREATE INDEX dupindexcols_i ON dupindexcols (f1, id, f1 text_pattern_ops);
-VACUUM ANALYZE dupindexcols;
+ANALYZE dupindexcols;
EXPLAIN (COSTS OFF)
SELECT count(*) FROM dupindexcols
- WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX';
- QUERY PLAN
----------------------------------------------------------------------------------
- Aggregate
- -> Index Only Scan using dupindexcols_i on dupindexcols
- Index Cond: ((f1 > 'MA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text))
-(3 rows)
+ WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX';
+ QUERY PLAN
+---------------------------------------------------------------------------------------
+ Aggregate
+ -> Bitmap Heap Scan on dupindexcols
+ Recheck Cond: ((f1 > 'WA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text))
+ -> Bitmap Index Scan on dupindexcols_i
+ Index Cond: ((f1 > 'WA'::text) AND (id < 1000) AND (f1 ~<~ 'YX'::text))
+(5 rows)
SELECT count(*) FROM dupindexcols
- WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX';
+ WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX';
count
-------
- 497
+ 97
(1 row)
CREATE TABLE dupindexcols AS
SELECT unique1 as id, stringu2::text as f1 FROM tenk1;
CREATE INDEX dupindexcols_i ON dupindexcols (f1, id, f1 text_pattern_ops);
-VACUUM ANALYZE dupindexcols;
+ANALYZE dupindexcols;
EXPLAIN (COSTS OFF)
SELECT count(*) FROM dupindexcols
- WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX';
+ WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX';
SELECT count(*) FROM dupindexcols
- WHERE f1 > 'MA' and id < 1000 and f1 ~<~ 'YX';
+ WHERE f1 > 'WA' and id < 1000 and f1 ~<~ 'YX';