Christian Rengstl wrote:
> My version is 8.1.4. Here is the plan for the query, it's performed on a
> smaller table, though because i can't access the biggest table at the
> moment:
> QUERY PLAN
>
>
-----------------------------------------------------------------------------------------------------------------------------
>
> Bitmap Heap Scan on mytable (cost=67.48..16738.24 rows=6519 width=10)
> (actual time=34.033..1903.106 rows=1 loops=1)
> Recheck Cond: ((pid)::text = 'ZZZ000110011'::text)
>
> Filter: ((crit)::text = '915677'::text)
>
> -> Bitmap Index Scan on idx_pid_22 (cost=0.00..67.48 rows=8996
> width=0) (actual time=12.998..12.998 rows=6207 loops=1)
> Index Cond: ((pid)::text = 'ZZZ000110011'::text)
>
> Total runtime: 1903.894 ms
>
> And yes i have indexes on both pid (varchar(15)) and crit(varchar(13)).
That's not quite what Andreas asked. Do you have an index on (pid, crit)?
--
Richard Huxton
Archonet Ltd