Thank you Jeff
I tried on PostgreSQL 9.1.0, and found the running result is:
postgres=# explain execute s(2);
QUERY PLAN
--------------------------------------------------------------------------------
-
Bitmap Heap Scan on tst01 t (cost=626.59..1486.25 rows=33333 width=4)
Recheck Cond: (id < $1)
-> Bitmap Index Scan on idx_tst01_id (cost=0.00..618.26 rows=33333 width=0)
Index Cond: (id < $1)
(4 rows)
postgres=# explain execute s(10000);
QUERY PLAN
--------------------------------------------------------------------------------
-
Bitmap Heap Scan on tst01 t (cost=626.59..1486.25 rows=33333 width=4)
Recheck Cond: (id < $1)
-> Bitmap Index Scan on idx_tst01_id (cost=0.00..618.26 rows=33333 width=0)
Index Cond: (id < $1)
(4 rows)
postgres=#
I want to know some internal about the "parameterized path".
I guess that Before PG9.2,
After I called prepare command, the path and plan is already created and done.
The plan is based on average estimation of all kinds of paths.
So even when I put different parameter, it just execute the same finished plan.