The sum of all SQL Server matter that exist,
and the space in which all SQL Server events
occur or could occur.
Welcome to SQL Server Universe.com Sign in | Join | Help
in
Home SS SLUG Forums Articles Photos Downloads

indexes

Last post 09-13-2008, 14:13 by G.R.Preethiviraj Kulasingham. 5 replies.
Sort Posts: Previous
  • indexes

     09-11-2008, 14:12

    • Joined on 08-10-2008
    • Posts 9
    • Points 0
    • Top 25 Contributor

    hi,

    i want to know how can i retrieve data from a table using indexes?

     

  • Re: indexes

     09-11-2008, 14:28

    • Joined on 11-22-2006
    • Colombo, Sri Lanka
    • Posts 102
    • Points 0
    • Top 10 Contributor
      Male
    Hi Methsika,

    SQL Server automatically uses indexes if exist and can be used for query you execute. If you want to know whether the index is being used for your query, see the execution plan.

    If SQL Server does not use the index available, again you can force SQL Server to use the index by using INDEX table hint.

  • Re: indexes

     09-12-2008, 16:39

    • Joined on 08-10-2008
    • Posts 9
    • Points 0
    • Top 25 Contributor

    hi,

    actually there i meant that regarding the "create index" command and how can i retrieve data from those.

  • Re: indexes

     09-12-2008, 21:14

    • Joined on 04-02-2007
    • Colombo
    • Posts 28
    • Points 0
    • Top 10 Contributor
      Male
    Your question is still not clear to me. "Create Index" command is used to create an index against a table. This command is not used to retreive data.
    Do you want to know about Create Index Command?
    Do you want to know what columns are beign used on an Existing index?
    Do you want to retreive data from table by using the index only? (without doing a table scan)

    Please give additional details on the question. ... Thanks
    G.R.Preethiviraj Kulasingham MCITP: DBA
    http://preethiviraj.blogspot.com/
    Plan Your Work and Work Your Plan!
  • Re: indexes

     09-13-2008, 11:41

    • Joined on 08-10-2008
    • Posts 9
    • Points 0
    • Top 25 Contributor
     yes sir,exactly i need explanation on the questions you raised regarding my post 
  • Re: indexes

     09-13-2008, 14:13

    • Joined on 04-02-2007
    • Colombo
    • Posts 28
    • Points 0
    • Top 10 Contributor
      Male
    ok. It looks like you want to know everything about index. This is not the right place to give all the details about index. It needs at least an article, probabily a book to discuss all about index. Let me summarize things as much as possible:

    Question: Do you want to know about Create Index Command?
    To create an index you can use CREATE INDEX ON .([,

    Question:Do you want to know what columns are beign used on an Existing index?
    EXEC sp_HelpIndex will give details of the indices used, and the columns used. you can also get the details using sysindexes categolg view. Additionally, sysindexkeys will give the columns assigned to an index

    Question: Do you want to retreive data from table by using the index only? (without doing a table scan).
    If you refer the only columns used by a nonclustered index and clustered index in your query, there is a high possibility you will use only the index. (Yes there is a remote chance you may go aginst clustered index scan, which is almost equal to table scan) Limiting the columns is important because of this reason.

    Hope this helps.
    G.R.Preethiviraj Kulasingham MCITP: DBA
    http://preethiviraj.blogspot.com/
    Plan Your Work and Work Your Plan!
View as RSS news feed in XML

(Best viewed with a resolution of more than 1024 * 768)

Powered by Community Server, by Telligent Systems