ossc-db / pg_hint_plan

Extension adding support for optimizer hints in PostgreSQL
Other
710 stars 103 forks source link

Discrepancy in the costs of prepared operators depending on the architecture of the system #192

Closed Xen-On-core closed 5 months ago

Xen-On-core commented 5 months ago

For reproduce that, you can use follow script

CREATE TABLE t1 AS SELECT a FROM generate_series(0, 999) a;
CREATE INDEX ON t1(a);

-- seqscan
SET enable_seqscan = on;
SET enable_indexscan = off;
SET enable_bitmapscan = off;
PREPARE p1 AS SELECT * FROM t1 WHERE a < 999;
EXPLAIN EXECUTE p1;
DEALLOCATE p1;

-- indexscan
SET enable_seqscan = off;
SET enable_indexscan = on;
SET enable_bitmapscan = off;
PREPARE p1 AS SELECT * FROM t1 WHERE a < 999;
EXPLAIN EXECUTE p1;
DEALLOCATE p1;

-- bitmapscan
SET enable_seqscan = off;
SET enable_indexscan = off;
SET enable_bitmapscan = on;
PREPARE p1 AS SELECT * FROM t1 WHERE a < 999;
EXPLAIN EXECUTE p1;
DEALLOCATE p1;

DROP TABLE t1;

I'm not sure if this is the right. Is this the expected behavior?

michaelpq commented 5 months ago

In what is that related to this extension?

Xen-On-core commented 5 months ago

@michaelpq, sorry, I didn't notice that you have already fixed this problem.

michaelpq commented 5 months ago

My mistake as well, I guess. I did not see any references to the regression tests in your initial report.