Other version of my problem:
If WHERE contains used_from=now()::date, then query can use index(es).
If WHERE contains "<=" or "<" or ">", then query not use indexes.
I'm checking the multicolumn indexes+btree:
On the postgresql page:
http://www.postgresql.org/docs/8.3/i...lticolumn.html
contains: "Currently, only the B-tree and GiST index types support multicolumn indexes. Up to 32 columns can be specified. "
What can i do?
Indexes:
"idx_ext_unit_hier_used_from" btree (used_from), tablespace "idx_space"
"idx_ext_unit_hier_used_to" btree (used_to), tablespace "idx_space"
telefon=# EXPLAIN SELECT * FROM ext.ext_unit_hier WHERE used_from=now()::date;
QUERY PLAN
-------------------------------------------------------------------------------------------
Bitmap Heap Scan on ext_unit_hier (cost=4.67..66.13 rows=54 width=36)
Recheck Cond: (used_from = (now())::date)
-> Bitmap Index Scan on idx_ext_unit_hier_used_from (cost=0.00..4.66 rows=54 width=0)
Index Cond: (used_from = (now())::date)
(4 rows)
telefon=# EXPLAIN SELECT * FROM ext.ext_unit_hier WHERE used_from<=now()::date;
QUERY PLAN
-------------------------------------------------------------------
Seq Scan on ext_unit_hier (cost=0.00..187.50 rows=7343 width=36)
Filter: (used_from <= (now())::date)
(2 rows)
telefon=# EXPLAIN SELECT * FROM ext.ext_unit_hier WHERE used_from<now()::date;
QUERY PLAN
-------------------------------------------------------------------
Seq Scan on ext_unit_hier (cost=0.00..187.50 rows=7343 width=36)
Filter: (used_from < (now())::date)
(2 rows)