Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6599415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:29:17+00:00 2026-05-25T18:29:17+00:00

I am experiencing some negative performance on queries that are sorted. This is how

  • 0

I am experiencing some negative performance on queries that are sorted.

This is how the query is being generated and rendered by NHibernate:

SELECT   TOP 50 y0_,
                y1_
FROM     **(SELECT distinct r1_.Id                         as y0_,
                          this_.Id                       as y1_,
                          ROW_NUMBER()
                            OVER(ORDER BY this_.Id DESC) as __hibernate_sort_row
          FROM   Event this_
                 inner join Registration r1_
                   on this_.Id = r1_.EventId
          WHERE  this_.IsDeleted = 0 /* @p2 */
                 and this_.SportId in (22 /* @p3 */)) as query**
WHERE    query.__hibernate_sort_row > 20
ORDER BY query.__hibernate_sort_row;

The bold part(within the **-symbols) is fetching all the results and puts them in order – this is what takes time.
Is there any way i can make this query more efficient? I just want to make sorting and paging possible without having to create too much overhead.

I am using NHibernate 2.1. Any improvements in future releases that relates to my problem?

Best regards,
Mattias

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:29:17+00:00Added an answer on May 25, 2026 at 6:29 pm

    Run the query through the database tuning advisor, most likely there is a missing (or bad) index.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am experiencing some performance problems when creating a very simple Python HTTP server.
I'm debugging a service that's experiencing some problems on start-up. To aid me in
I'm experiencing some behavior I did not expect. I have a synchronous procedure that
I am experiencing some strange problems with NHibernate and the usage of proxy items
I am experiencing some odd behaviour with NHibernate. I'm retrieving a list of Learners
I'm experiencing some weird behavior with SELECT statements in sqlite. There is one table
I'm experiencing some craziness that I just can't figure out. I've created the following
I'm experiencing some performance problems loading about 60 images from a SQLite3 table with
I'm currently experiencing some scrolling issues in a few of my views. The performance
we have a customer that's been experiencing some blocking issues with our database application.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.