'does odata do its filtering on the database or on my iis host?

if I implement the following api toystore.com/api/toys?$select=prodId&$filter=startswith(CompanyId,'lego') in ASP.NET, MVC, using odata3 and EF. Does that query get evaluated on my database (which is indexed and good at filtering) or do I retrieve all 100k rows and then filter them on my IIS webserver in memory? If it's the latter is there a way to make this more performant. thanks

edit - clarifying... "can" asp.net odata queries ever filter on the database or are they always evaluated on the IIS?

related: Enable lazy loading on OData URL Query



Solution 1:[1]

If you return with IQueryable, where condition will be added in sql query. Thus, it will not pull all the data from the database. If you return an IEnumerable instead of IQueryable, it will pull all the data and filter it in iis.

I hope I have helped.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anıl ÇETİN