DROP TABLE foo;
CREATE TABLE foo
(id  integer primary key
,col1 text
);
CREATE INDEX ON foo (col1);

-- create non-uniform distrbn of col1 values
INSERT INTO foo
SELECT generate_series(1,10000), 'a';
INSERT INTO foo
SELECT 10000+generate_series(1,1000), 'b';
INSERT INTO foo
SELECT 11000+generate_series(1,10000), 'c';

ANALYZE foo;

EXPLAIN (ANALYZE, BUFFERS)
SELECT * FROM foo WHERE col1 = 'b' ORDER BY id DESC
LIMIT 10;
EXPLAIN (ANALYZE, BUFFERS)
SELECT * FROM foo WHERE col1 = 'b' ORDER BY id DESC
LIMIT 100;
