Thread: Index not used with user

Index not used with user

From
gelinas@tech-m4.com
Date:
Hi,
i don't understand why my index is not used when i place a constant in
my query.

explain select * from employes2 where usager='postgres';
NOTICE:  QUERY PLAN:

Index Scan using employes2_usager on employes2  (cost=0.00..2.01 rows=1
width=222)

EXPLAIN
explain select * from employes2 where usager=user;
NOTICE:  QUERY PLAN:

Seq Scan on employes2  (cost=0.00..2.81 rows=1 width=222)

EXPLAIN

Can you help me?

--
Steve Gelinas
System administrator