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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:15:25+00:00 2026-06-06T18:15:25+00:00

So lately when I run queries on huge tables I’ll use the the top

  • 0

So lately when I run queries on huge tables I’ll use the the top 10 * notation like so:

select  top 10 * from BI_Sessions (nolock)
where SessionSID like 'b6d%'
and CreateDate between '03-15-2012' AND '05-18-2012'

I thought that it let’s it run faster, but it doesn’t seem so , this one took 4 minutes(or is that OK time)?

I guess I’m curious about whether the top functionality happens after it pulls all the data anyway(which would seem like it’s inefficient).

thanks

  • 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-06T18:15:26+00:00Added an answer on June 6, 2026 at 6:15 pm

    It entirely depends on the query, with the exceptino of “Top 0”. “Top 0” does return much faster.

    In your case, the query has to look through the rows in a huge table to find rows that match the WHERE clause. If no rows are found, the number of rows being returned doesn’t help. If the rows are at the end of the table scan, then the number of rows being returned doesn’t help.

    There are certain cases with more complicated queries where the “top” could affect performance. There is a difference between optimizing overall and for the first row returned. I’m not sure if SQL Server’s optimizer recognizes this difference.

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

Sidebar

Related Questions

I have run into two situations lately where I have chosen to use the
I've been using term-mode (called by (term) ) more frequently lately to run some
Lately, I've often found myself wanting to run some command on the output of
I've been working on expanding my vim-foo lately and I've run across a couple
here's a problem that i've run into lately: I have a listview with a
I have run into some trouble lately with onSaveInstanceState() and onRestoreInstanceState() . I have
I've been playing around with Android lately and I've run into a problem building
Lately I have run in a strange NullReferenceException. It pops up only occasionally why
I've run into a problem with Ajax lately. I'm working on a frontend of
I'm doing lately so much C++ that I forgot how to use Java. I'm

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.