DA-LION-619
Honorary Master
Thanks Jonathan I will give that a go. LIMIT 1 possibly would have helped but that plan stopped dead as noticed that is MySql no MSSql. Shot man I will post the result after load shedding is finished.
South Africa’s biggest forum. Discuss, discover, and connect with thousands of members.
Thanks Jonathan I will give that a go. LIMIT 1 possibly would have helped but that plan stopped dead as noticed that is MySql no MSSql. Shot man I will post the result after load shedding is finished.
Group by customer ID and order it, would do top 3 to reduce size. That then in a temp table and select the row number. https://stackoverflow.com/questions/1022514/selecting-nth-record-in-an-sql-query
Outside of sql server, Maria db has limit with offset, think only oracle and ms don't have support still, but haven't used oracle in 5 years and haven't had a need to solve a problem like this in a long time where didn't need the result sets other results as well.
Yep, that was like 2 mins before falling asleep while typing on my phone.Would have to have a "count" in there somewhere, I reckon
![]()
SQL COUNT - Returns the Number of Rows in a Specified Table
In this tutorial, you will learn about the SQL COUNT function that returns the number of rows in a specified table.www.zentut.com
Linqpad is great. Pity it only works on windowsCheat lol. https://www.linqpad.net/ will show you the SQL generated.
Linqpad is great. Pity it only works on windows
^thats only the ‘sql’ features, there’s tons more.Why it's great:
- You can import existing EF6 and EF Core DB Context's into it
- You can live build LINQ queries without having to do this in actual code, and run an application (you can probably achieve the same thing with a unit test, but it's not as slick and seamless)
- You can update your DB context in your IDE (add new models, update existing models), and then just build (not run) the project containing the DB context, and it will be available in LINQPad
- Easily see the SQL generated, so newcomers can understand what LINQ expressions are actually doing
You have a better way to establish a baseline for metrics to monitor for regressions?As a C/php developer (someone who breathes it), let me tell you, stored procedures are the devil's dick. Don't suck it.
There's always a better way to do it.
In the very rare edge case where it is needed, there's still a better way, but if you absolutely insist then please be incredibly mindful about it.
Disagree with this, SP can be very useful, it always depends.As a C/php developer (someone who breathes it), let me tell you, stored procedures are the devil's dick. Don't suck it.
There's always a better way to do it.
In the very rare edge case where it is needed, there's still a better way, but if you absolutely insist then please be incredibly mindful about it.
Why would you need an SP to monitor regression?You have a better way to establish a baseline for metrics to monitor for regressions?
// looks at Woolworths DB.For things like Thor's projects, I would not see the point of SP's at all and would find it strange if he used them.
You don’t need an SP, you could use a View but a query doesn’t give the whole picture for performance.Why would you need an SP to monitor regression?
Fair enough, I get what you are saying.You don’t need an SP, you could use a View but a query doesn’t give the whole picture for performance.
You need consistency and that’s hard thing to establish in an app environment.
You update your ORM and now EF is generating one query per LINQ statement, or using inner joins, maybe the query is the same but it ‘feels’ slower(different query plan).
SQL Server is smart but sometimes it needs help, that’s why you need to monitor and compare against a baseline.