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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:59:55+00:00 2026-05-15T08:59:55+00:00

I know there is no guarantee without an ORDER BY clause, but are there

  • 0

I know there is no guarantee without an ORDER BY clause, but are there any techniques to tune SQL Server tables so they’re more likely to return rows in clustered index order, without having to specify ORDER BY every single time I want to run a super-quick ad hoc query? For example, would rebuilding my clustered index or updating statistics help?

Out of all the many tables we use, I’ve only noticed two ever giving me results in an unpredicted order. This is really just an annoyance, but it would be nice to be able to minimize it. In case this is relevant because of page boundary issues or something like that, I should mention that one of the tables that has inconsistent ordering, is the longest table we have that has a clustered index on an identity column.

Edit: deleted the specific example, because I think the example made this read more like a “help me with this query” question, when I just wanted to use the example to illustrate the abstract question.

  • 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-15T08:59:56+00:00Added an answer on May 15, 2026 at 8:59 am

    If you want the result set to be ordered in a specific way, use ORDER BY.
    If you want the query to be accessed using a specific index, you may want to use an INDEX table hint, but they are strongly discouraged.

    In your particular example, accessing a very large accesslog table that is clustered by an IDENTITY to query all rows for a particular UserId is the last thing you want. You want to have an index by UserId and you want the query to use that index. As a side note, access log tables clustered by an IDENTITY are usually not a good choice, because the typical access is by time range (accesses between t1 and t2) or by other attribute (by userId, like in your example, or by machineId, or similar). None of these is ever satisfied by a clustered index on an IDENTITY column.

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

Sidebar

Related Questions

I know there is a lot of controversy (maybe not controversy, but arguments at
I know there has to be a way: I need help getting any hot
I know there is ongoing work for in this regards but what is the
I know there is a very similar question here but I was hoping to
I know there is a StringIO stream in Python, but is there such a
When you call C's malloc , is there any guarantee about what the first
Coming from Python and Javascript background, I'd like to know if there is any
I know there is a lot of talk about BPM these days and I
I know there are implementations of Python and of Perl for .NET. Have you
I know there is the current() function to retrieve the current node in XSL,

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.