Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Solution with JOIN LATERAL is not working correctly (it returns for some categories 4 most viewed posts intead of 2). At the same time solution with ROW_NUMBER returns right result.
Please try two solutions and you will see...
New to lateral join, how does limit 2 select the top 2 posts of every categories? Doesn't ORDER BY views DESC LIMIT 2 just select the top 2 viewed post from any category?
usual on condition, when there is TRUE, it always pass
This comment is hidden because it contains spoiler information about the solution
guys, spoiler flag...
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Did you check the explain plan? Not exists supposed to stop processing it after finding the first record. It does not check every matching row. So adding lmit 1 shouldn't change anything.
in my opinion it can be boosted by adding limit 1 before where-statement to stop as minimum 80% of calculations