Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array.Contains(x) run without using pg indexes #1200

Closed
PDarkTemplar opened this issue Jan 15, 2020 · 1 comment
Closed

array.Contains(x) run without using pg indexes #1200

PDarkTemplar opened this issue Jan 15, 2020 · 1 comment

Comments

@PDarkTemplar
Copy link

PDarkTemplar commented Jan 15, 2020

We have code like this:

var values = data.ToArray(); // [1,2,3]
var res = DbSet<Call>.Where(x => values.Contains(x.Id));

and efcore.pg 3.1 generating sql like this:

select * from calls where COALESCE(id = ANY ([1,2,3]), FALSE)) 

plus sometimes

and array_position(....) is null

Because of COALESCE, pg running fullscan without using id index.
We have around 400 mil rows in partitioned Call table.

In efcore.pg 3.0 when there was IN clause pg was using indexes and all was fine.

@PDarkTemplar
Copy link
Author

found in #1152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant