all groups > sql server (alternate) > march 2004 >
You're in the

sql server (alternate)

group:

Native logical ordering of table?


Native logical ordering of table? M Wells
3/31/2004 9:41:29 PM
sql server (alternate): Hi All,

Just wondering if anyone can tell me if tables in SQL Server 2000
default to a native logical ordering, particularly if there's a
primary index on a field? IE, if I have a primary index on column
member_id, and I do a select with various criteria but which doesn't
have any order by clause, will it get the first record matching the
criteria in the order of the primary key on member_id?

Any help appreciated!

Much warmth,

Re: Native logical ordering of table? M Wells
3/31/2004 10:03:09 PM
On Wed, 31 Mar 2004 23:02:39 +0100, "David Portas"
[quoted text, click to view]

Thanks for your help, David!

Much warmth,

Re: Native logical ordering of table? David Portas
3/31/2004 11:02:39 PM
No, there is no logical order. The only reliable way to fix the order of a
SELECT statement is to use an ORDER BY clause. Without that the order will
be determined by the chosen execution plan and by other indeterminate
factors such as cacheing and physical storage.

--
David Portas
SQL Server MVP
--

Re: Native logical ordering of table? M Wells
4/1/2004 4:16:24 PM
On Wed, 31 Mar 2004 23:02:39 +0100, "David Portas"
[quoted text, click to view]

Hi David,

I'm just wondering if you can tell me if adding an order by clause
that only uses a column with a clustered primary index on it can slow
down a query?

Much warmth,

AddThis Social Bookmark Button