Re: Left Join and Order by

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Anyway, the way the table is ordered on disk is also logically (with double-linked list) when it has a clustered index.

So, depends point of view, you can talk about order or not... I feel more agree with Tibor

--
-----------------------------
"Caminar sobre el agua y desarrollar software a partir de unas
especificaciones es fácil, si ambas están congeladas."
Edward V. Berard, ingeniero informático

http://blogs.solidq.com/es/elrincondeldba


"RickNZ" <kiessig@xxxxxxxxxxxxxxxxx> wrote in message news:B2B947DE-9459-4F23-93BB-C26381FB3F5C@xxxxxxxxxxxxxxxx
Correct. A table isn't ordered. You define the order for rows when you
return data from a table, using the ORDER BY clause.

Well, not strictly true.

An ORDER BY clause certainly doesn't change anything in the way a table is
ordered on disk. However, if a table has a clustered index, then it
definitely is ordered on disk, based on that index. In that case, the order
determination is made at insert or update time, not at select time.

--
Check out my upcoming book: ASP.NET: Building Ultra-Fast and Ultra-Scalable
Websites Using ASP.NET and SQL Server


.



Relevant Pages

  • Re: Left Join and Order by
    ... An ORDER BY clause certainly doesn't change anything in the way a table is ... However, if a table has a clustered index, then it ... definitely is ordered on disk, ... determination is made at insert or update time, ...
    (microsoft.public.sqlserver.programming)
  • Re: Do I care about this?
    ... > the order of the clustered primary key ... The clustered index does not indicate the ON DISK order. ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Using a character GUID for the primary key - Any issues to know ab
    ... a clustered index ensures that only one disk will ever be used - the disk ... using Identity stops you from later using partitioning if you need to in SQL ...
    (microsoft.public.sqlserver.server)
  • Re: Compound Primary Key - order not as expected
    ... the physical order on disk may be yet another one. ... data in the order of the clustered index ... This may have been true by chance for SQL Server up version 6.5. ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Compound Primary Key - order not as expected
    ... when a clustered index is present the records *are* physically ordered ... "piggybacking" - if a query on another connection is in the middle of a ... for your query as well, then (when the first query's table scan is ... disk when a *compound* clustered index is present ...
    (comp.databases.ms-sqlserver)