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

  • Home
  • SEARCH
  • 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 8078397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:46:50+00:00 2026-06-05T15:46:50+00:00

So I was writing some queries today and was using top 10 on a

  • 0

So I was writing some queries today and was using top 10 on a query just to get some sample data without an orderby and noticed it was actually returning different data on each call. It did not seem random however as it is a table with millions of rows and some entries always showed up, while others changed every call. What logic goes on in the back end to decide which rows to return when no orderby is specified? I am using SQL Server 2008r2, but I’d be interested if it is handled differently in other DBs.

  • 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-05T15:46:52+00:00Added an answer on June 5, 2026 at 3:46 pm

    Of course the order is entirely undefined. But I’ll try to mention some actual causes in real implementations because this was explicitly asked for. Here is a small sample:

    • parallel query plan
    • read-ahead results returning in random order
    • the execution plan changed for some reason
    • read of a column store index returns rows in internal order
    • SQL Server is choosing an unordered index scan which is reading the pages in allocation order and not in logical order (the allocation order can change by reorganizing the table for example)

    These causes are specific for SQL Server.

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

Sidebar

Related Questions

I am writing some new SQL queries and want to check the query plans
I'm writing a query to summarize some data. I have a flag in the
I'm writing some Database queries with Propel(symfony), but propel always add some query! For
I can't get away without writing some dynamic sql conditions in a part of
I'm new to linq and having trouble writing two simple queries. For some reason,
Just writing some CSS and I have a pretty cool Search form where you
I've been writing some pretty long SQL queries in notepad and then pasting them
I'm writing some named queries for my domain classes in Grails and I've hit
I am writing a PL/SQL procedure that needs to to dynamically generate some queries,
I am writing some SQL and using AdoDb to connect to my database and

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.