Why PostgreSQL multi-column index not working for first column?
Solution 1:
Thanks to @thorsten-kettner
If fetched records so many rows, will not use index.
I try to use another eq_id
with small result sets and index is working:
# select count(*), eq_id from para_data group by eq_id;
count | eq_id
-------+------------------
52501 | 0100C0130479A5F1
52348 | 020090120479F281
52614 | 020280240479A5F1
559 | 070030210481AEF9
7013 | 0F0180340479F349
3910 | 130230120479F281
229 | 1500C0280479F349
2014 | 150100340479F349
86 | 150270330479F349
3357 | 1600B02E0479F349
# explain analyze verbose SELECT "ch00_status", "ch00_wf_peak_peak" FROM para_data WHERE eq_id = '070030210481AEF9';
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan using para_data_eq_id_timestamp_high_idx on public.para_data (cost=0.42..1146.48 rows=588 width=16) (actual time=0.027..0.325 rows=559 loops=1)
Output: ch00_status, ch00_wf_peak_peak
Index Cond: ((para_data.eq_id)::text = '070030210481AEF9'::text)
Planning Time: 0.049 ms
Execution Time: 0.350 ms
Thanks to you all.