473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How does data indexing work in MS SQL?

I am newbie in MS SQL. Can anyone show me how indexing works in a database??
Dec 21 '10 #1
4 2350
gpl
152 100+
What do you mean by 'how it works' - what data structures it uses to store the keys ? or how to use indexes ... and where?
Dec 21 '10 #2
I mean how to use index in a table..
Dec 22 '10 #3
gpl
152 100+
Very simply, use this (but read the relevant articles in Books Online)
CREATE UNIQUE INDEX name_of_index ON dbo.table_name (column_name_1, column_name_2 .... etc)

Primary keys are also indexes and are often CLUSTERED - this means the rows are stored in the order the index specifies, and ordinary index keeps a 'table' of the key values and points to the actual rows.

Note that if you do not pick your primary key carefully and have lots of insertions in different parts of the table, then there will have to be a lot of shuffling of data, causing a big performance drop; if you always add data to the end (using an incrementing integer for example) then this will not be a problem

Hope this helps
Dec 22 '10 #4
indeed it helps..Thanks...^^
Dec 23 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: jani | last post by:
Hi, i am using a database which contains kanji characters with shift-jis encoding, and i want to show the characters in a datagrid. Now i am using a sqldataset as data source, and show the data...
1
by: alyssa | last post by:
my prog works like this...i had created a summary report form where there is a text box, data grid and a button. when the user enter the customer id in the text box and press the button, the data...
2
by: yuanh23 | last post by:
Hi, I have 3 talbes "customers","orders","details". i wanna to use 3 datagrids to show those tables. and when the selected row in parent talbe changes, the selected row in child table changes...
3
by: Tim Baur | last post by:
I'm a VB6 developer who's just beginning to make the move to .Net 2005, and I'm wondering if data binding is worth the effort. After a lot of fighting with it in VB6, I finally realized the best...
4
by: Joe-Paul | last post by:
Hi: I'm running a simple query on an Access Table from VB6.0. The operator can make several different selections. Based on their selection, a different, specific SQL needs to be run. So, when...
3
by: Barry | last post by:
Hi have a webpage with some controls at the top and a Table control at the bottom. programmatically add the table header and Data rows using TableRow() and Cells using Cell(), the Table is...
3
by: tparks69 | last post by:
I am getting data from an FTP into a Stream object. Now I need to put this data into a string so I can manipulate it. Can anyone show me some example code?
4
by: Johnny | last post by:
Hi all: I am trying to write some code to read an Excel spreadsheet from an ASP.NET application. For some reason no fields that have a number in them are read, while text data is read just fine....
8
by: obtrs | last post by:
show data of multiple tables? i have 3 tables i want to show the data from them to a page. table1 "trip" table2 "seat" table3 "user_information" show all the data of table one which is...
0
by: cadab | last post by:
I have a data grid view, i have specified several columns through the designer that i would like to show on the grid, i have mapped them to the datasource, this works fine, the problem is, my data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.