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 7928125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:39:15+00:00 2026-06-03T19:39:15+00:00

maybe anybody can help me out with a quite strange behaviour using hibernate and

  • 0

maybe anybody can help me out with a quite strange behaviour using hibernate and oracle.
It is the first time that i use hibernate and oracle, so it might be an easy step for you :).

But lets get into detail. A simple count(*) results in:

 select * from ( select count(*) as col_0_0_ from TABLE tbl ) where rownum <= ?

That would not be a big deal, but if i have a selection with a limited amount of rows to be returned, it looks like that:

select * from ( select SOME_FIELDS from TABLE tbl order by tbl.ID desc ) where rownum <= 20

And that is not very fast. If i do it by my own like

select * from from TABLE tbl where rownum <= 20 order by tbl.ID desc 

it is as fast as expected.
Is there anything a can do against? Maybe my entity needs some more tags?

Thank You!

  • 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-06-03T19:39:17+00:00Added an answer on June 3, 2026 at 7:39 pm

    The first query doesn’t make much sense, since a select count(*) returns only 1 row.

    The second is probably the one you really want.

    The third one looks like the second one, but doesn’t do the same thing at all. The order by clause is applied after the where clause. So the third query selects the first 20 rows from the table, without any specific order, and sorts these 20 rows by ID. The second query selects the rows from the table, sorts them by ID, and return only the 20 first rows from these sorted rows.

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

Sidebar

Related Questions

Maybe I just can't figure out the right keywords to get an answer out
Can anybody help or point me in the right direction for a tutorial/example for
Can anybody show me (maybe copy/paste a simple code example) how to create the
Can anybody help me in this? I want to get an screenshot from an
I can't find any examples of how to use models that contain multiple words
can anybody help with the above SourceSafe error? I've spent hours trying to find
I'd like to make a linear score formula that I can use in a
Maybe it's because of the dark outside, but I can't get this Position geom_text
Maybe it's wrong but I always use this query for my app: cme_only =
Maybe this is a poor question, but, I can't find a tutorial or even

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.