En que momento creaste el constraint?
Copié y pegué tu codigo e hice un explain.
Código SQL:
Ver originalpruebas=> CREATE TABLE userstatus
pruebas-> (
pruebas(> username CHARACTER VARYING(64) NOT NULL,
pruebas(> resource CHARACTER VARYING(64) NOT NULL,
pruebas(> online INTEGER NOT NULL,
pruebas(> presence CHARACTER(15),
pruebas(> lastipaddress CHARACTER(15) NOT NULL,
pruebas(> lastlogindate CHARACTER(15) NOT NULL,
pruebas(> lastlogoffdate CHARACTER(15),
pruebas(> CONSTRAINT userstatus_pk PRIMARY KEY (username, resource)
pruebas(> );
NOTICE: CREATE TABLE / PRIMARY KEY will CREATE implicit INDEX "userstatus_pk" FOR TABLE "userstatus
"
CREATE TABLE
pruebas=> EXPLAIN SELECT *FROM userstatus WHERE username = 'ale600' AND resource = 'sistema';
QUERY PLAN
----------------------------------------------------------------------------------------------
INDEX Scan USING userstatus_pk ON userstatus (cost=0.00..8.27 ROWS=1 width=180)
INDEX Cond: (((username)::text = 'ale600'::text) AND ((resource)::text = 'sistema'::text))
(2 filas)