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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:30:32+00:00 2026-06-10T23:30:32+00:00

I have been running a sql query for large number of rows in a

  • 0

I have been running a sql query for large number of rows in a table. The structure of query is similar to the following query.

SELECT id FROM
(
SELECT
     id,(ROW_NUMBER() OVER (ORDER BY id)) AS Row 
FROM 
     <table>
)
temp_table WHERE Row BETWEEN 1 AND 50

I am using paging at the UI so that I need fifty records in a single fetch. My concern is that, I am fetching all the records and then select 50 from them isnt there a way that allows me to select only those records that I truly need. Please note that this a simplified query the original query is very complex and have lot of joins. Is there any standard way of implementing queries that support paging?

  • 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-10T23:30:33+00:00Added an answer on June 10, 2026 at 11:30 pm

    What I suggest here is:

    1.Create a indexed view(view_sample) with the query

    SELECT
         id,(ROW_NUMBER() OVER (ORDER BY id)) AS Row 
    FROM 
         <table>
    

    2.Now create an index (clustered) on row

    3.Select id from view_sample where Row BETWEEN 1 AND 50

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

Sidebar

Related Questions

I have been running the following query against a table 56GB in size (789700760
I have been running a mammoth SQL query that is as so: select SessionID,
I have a long-running SQL Server 2005 query that I have been hoping to
Edit: Im running SQL Server 2008 I have about 400,000 rows in my table.
I have been on this mysql query for 2 days running. This is the
I have a SQL query running using something like this: PreparedStatement pstmt = dbConn.prepareStatement(sqlQuery);
When running a select query (on SQL SERVER 2000+) with multiple where statements such
As part of a reporting setup, I have a SQL query fetching the number
I have a LINQ query which is searching a SQL table of around 250,000
I'm having trouble running a multi-argument search query in MySQL: SELECT item.* from item,

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.