On 10.10.2016 19:09, Pavel Stehule
wrote:
No! That's binary copy of whole database. Index are the same! But, when I ask database without "ORDER..." (SELECT b.id FROM kredytob b WHERE pesel = '22222222222';) then: "SLOW" "Index Scan using kredytob_pesel_typkred_opclass_idx on public.kredytob b (cost=0.43..115349.30 rows=113 width=4) (actual time=233.767..392.710 rows=5 loops=1)" " Output: id" " Index Cond: (b.pesel = '22222222222'::bpchar)" " Buffers: shared hit=19259" "Planning time: 0.254 ms" "Execution time: 392.761 ms" "FAST" "Index Scan using kredytob_pesel_typkred_opclass_idx on public.kredytob b (cost=0.43..115240.10 rows=112 width=4) (actual time=378.737..836.208 rows=5 loops=1)" " Output: id" " Index Cond: (b.pesel = '22222222222'::bpchar)" " Buffers: shared read=19237" "Planning time: 0.568 ms" "Execution time: 836.261 ms" So, index is used in both queries but when is "ORDER" then everything change... Why?
|