question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can Skipping Rows be supported

See 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 ...

Issue Analytics

  • State:open
  • Created 2 months ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ChrisJollyAUcommented, Jul 6, 2023

@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

1reaction
ChrisJollyAUcommented, Jul 6, 2023

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

In the JetQueryableMethodTranslatingExpressionVisitor I can override the functions for TranslateSkip and TranslateTake. Needed that for commit c8e109fb94a2f1ac802f56117f64aadff748b8cd when fixing cross joins followed by left join

Going to reopen this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

10 Chest Supported Dumbbell Row Alternatives for a Big ...
Yes, you can technically do Chest Supported Barbell Row with a bench but they're extremely awkward and usually not worth the hassle.
Read more >
The Chest-Supported Row: How to Do It Correctly
Chest-supported rows are one of the best row variations because they're particularly good at isolating your back muscles so you gain as much ......
Read more >
Beginners Should Build Back Muscle With the Chest ...
The chest-supported dumbbell row allows strength training beginners to build back muscle without potentially exposing themselves to injury.
Read more >
Why You Must Do Chest Supported Rows
Chest supported rows are some of the best back exercises that will help isolate the back muscles YET still allow you to lift...
Read more >
Chest-Supported Row - YouTube
Your browser can 't play this video. Learn more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found