jaystack / odata-v4-server

With JayStack OData v4 Server you can build your own data endpoints without the hassle of implementing any protocol-level code. This framework binds OData v4 requests to your annotated controller functions, and compiles OData v4 compatible response. Clients can access services through OData-compliant HTTP requests. We recommend the JayData library for consuming OData v4 APIs.
https://jaystack.com/products/jaystack-odata-v4-server/
76 stars 55 forks source link

A simple change that speeds up queries with $select #14

Closed cendrizzi closed 7 years ago

cendrizzi commented 7 years ago

Especially if you have a large model it doesn’t make sense to go through every property when the person doing the query is only getting a small a few of those properties in their query.

This speeds things up dramatically.

The implementation is simple. I take the incoming set of data (from the db query) and take the number of fields there against our total number of fields. If it's less then we know the request must have had a select to reduce the result set (or they model fields that don't actually exist).

Then to ensure we are not returning fields that aren't actually in the model and do an intersection of the two arrays.

lazarv commented 7 years ago

Sorry this change will break current feature set ($expand)