Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Index on system tables

Author  Topic 

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-02-20 : 06:00:31
Is there any way to find out indexing on system tables like sys.tables or sys.objects


Vabhav T

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-20 : 06:07:33
whats the need for that?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-20 : 06:21:40
quote:
Originally posted by vaibhavktiwari83

Is there any way to find out indexing on system tables like sys.tables or sys.objects


Vabhav T


They are System views. I dont think indexes are defined for them

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-02-20 : 06:32:19
Actually if i am looking some data then i want to know how they are physically sorted

Vabhav T
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-20 : 06:46:38
" physically sorted"

In a relational database they have no concept of physical order. They only get an order if you add an ORDER BY clause to your Select statement.
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-02-20 : 06:56:45
that means they store the data as it arrives

Vabhav T
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-20 : 07:36:00
quote:
Originally posted by vaibhavktiwari83

that means they store the data as it arrives

Vabhav T


No. It depends. Dont assume anything. If you want data in particular order use ORDER BY clause explicitely

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-20 : 08:03:37
"that means they store the data as it arrives"

No ... it may fill in an existing spare space, or if multiple rows are bulk-loaded it be pre-sorted into a different order (to better suit the database storage), or it may be stored by two parallel tasks, and thus split, or ... a whole variety of causes.

I repeat: a relational database has no defined physical order.

You can type "SELECT * FROM MyTable" and if MyTable has a clustered index (most tables do) then you will USUALLY get the rows in that order. But not always. It depends what is currently in memory cache, what other parallel tasks are going on, etc.

So do NOT assume that your data has any specific order ... unless you use ORDER BY in your Select.
Go to Top of Page
   

- Advertisement -