Em 26 de fev de 2016 4:44 PM, "joe meiring" <josephmeiring@xxxxxxxxx> escreveu:
>
> The same query for parameters is rather slow and does NOT use the index:
>
> EXPLAIN ANALYZE
> select *
> from parameter
> where exists (
> select 1 from datavalue
> where datavalue.parameter_id = parameter.id limit 1
> );
>
Please, could you execute both queries without the LIMIT 1 and show us the plans?
LIMIT in the inner query is like a fence and it caps some optimizations available for EXISTS, you'd better avoid it and see if you get a proper semi-join plan then.
Regards.