hi!
I have a table about following structure
Table = crs
+-------------------------------+--------------------------------+-------+
| Field | Type | Length|
+-------------------------------+--------------------------------+-------+
| crs_stop | char() | 32 |
| crs_dir | char() | 32 |
| crs_time | int4 | 4 |
| crs_opt | char() | 3 |
+-------------------------------+--------------------------------+-------+
Index: crs1_idx
and need speed up following query:
SELECT * FROM crs c1 WHERE c1.crs_stop='_some_stop' AND
c1.crs_dir='some_direction' ORDER BY c1.crs_time;
I built index:
+-----------------------------+----------------------------------+-------+
| Field | Type | Length|
+-----------------------------+----------------------------------+-------+
| crs_stop | char() | 32 |
| crs_dir | char() | 32 |
+-----------------------------+----------------------------------+-------+
but
EXPLAIN SELECT * FROM crs c1 WHERE c1.crs_stop='_some_stop' AND
c1.crs_dir='some_direction' ORDER BY c1.crs_time;
shows following:
NOTICE: QUERY PLAN:
Sort (cost=160.92 rows=1 width=40) -> Seq Scan on crs c1 (cost=160.92 rows=1 width=40)
EXPLAIN
so it doesn't use index.
What am I doing wrong?
Thanks in advanceRem
--
-------------------------------------------------------------------*------------
Remigiusz Sokolowski e-mail: rems@gdansk.sprint.pl * *
-----------------------------------------------------------------*****----------