Can Skipping Rows be supportedSee original GitHub issue
I tried to run a skip on and got error:
“Jet does not support skipping rows.”
Could you implement skip functionality usings the method below taken from https://stackoverflow.com/a/10455965/12439476:
If you know how many records you want to skip, then you could do something like this:
SELECT * FROM myTable x WHERE x.ID NOT IN (SELECT Top 10 id FROM myTable ORDER BY ....) ORDER BY ...
Then you could exclude the records that you don’t want.
If you then know the total number of records that you want to return, then you could do the following:
SELECT Top 50 * FROM myTable x WHERE x.ID NOT IN (SELECT Top 10 id FROM myTable ORDER BY ....) ORDER BY ...
- Created 2 months ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
@tb-mtg You should be able to use it when configuring Jet. It is one of the parameters when you call the
UseJet function. Just looked at the section from the test sources that I can play around with
public override DbContextOptionsBuilder AddProviderOptions(DbContextOptionsBuilder builder) => builder.UseJet(Connection, b => b.ApplyConfiguration().UseShortTextForSystemString().UseOuterSelectSkipEmulationViaDataReader()).EnableSensitiveDataLogging().EnableDetailedErrors();
Hopefully that gives you an area to look for
Was playing around wit the skip. Some progress but problem is finding the field to compare on with the
NOT IN. Your example your subquery is simple and just query for
id. Problem comes in to rewrite the normal query to find the field we need to compare on
- If the subquery is just a basic table then we might just look for the primary key
- It becomes more complex if the subquery is a complex query in itself or the table is keyless
- An example of the above would be if the subqquery returned only the fields of FirstName,LastName
I do have some ideas to play around with though
Yes, it is still there. However I’m not sure how well it still works and obviously it only works on the outer select. If I understand it correctly it sends the normal query to Jet, and only when it is pulling the results in through the datareader will it stop at the number of rows.
I think I can pick up the Expression and modify it. Probably going to need to push the current query down into a subquery and wrap in a new SelectExpression. Should be doable and would cover more scenarios than the current implementation. Though the SQL might get a bit interesting for some queries and have to see how the performance would be
JetQueryableMethodTranslatingExpressionVisitor I can override the functions for
TranslateTake. Needed that for commit c8e109fb94a2f1ac802f56117f64aadff748b8cd when fixing cross joins followed by left join
Going to reopen this issue