If I add a clustered index to a table in my SQL Server database will it increase application performance? (VB Application) The database was created sometime back and it has about 40MB of data.
If you create an appropriate index it can dramatically enhance performance.
From books-online, clustered indexes are good for:
Columns that contain a limited number of distinct values, such as a state column that contains only 50 distinct state codes. However, if there are very few distinct values, such as only 1 and 0, no index should be created.
Queries that return a range of values using operators such as BETWEEN, >, >=, <, and <=.
Columns that are accessed sequentially.
Queries that return large result sets.
Columns that are frequently accessed by queries involving join or GROUP BY clauses; typically these are foreign key columns. An index on the column(s) specified in the ORDER BY or GROUP BY clause eliminates the need for SQL Server to sort the data because the rows are already sorted. This improves query performance.
OLTP-type applications where very fast single row lookup is required, typically by means of the primary key. Create a clustered index on the primary key.
Clustered indexes are not a good choice for:
Columns that undergo frequent changes because this results in the entire row moving (because SQL Server must keep the row’s data values in physical order). This is an important consideration in high-volume transaction processing systems where data tends to be volatile.
Covered queries. The more columns within the search key, the greater the chance for the data in the indexed column to change, resulting in additional I/O.
I strongly suggest you read up on indexes in books online...
Tom gave a stellar overview of the use of clustered indexes. Shaminda, if you could give us the table structure and an approximation of the selectivity (uniqueness) of the column(s) you have in mind, we might be able to answer more precisely.
On very small tables, I wouldn't put an index on them either. On a table with a few thousand rows, I would put an index on it. If it had a few hundred rows or less, then I wouldn't place an index on it.
This is a relative measure, so you may have to generalize your policy, such as look-up tables don't get them, but updated tables do, or whatever...
This is one of the queries
SQL = "SELECT * FROM [tblRack_PDSN] WHERE [PDSN] = '" & Right(rp![Product_ID_JS], 4) & "' AND [866_ID] = '" & int866 - 1 & "';"
and vb code
.addnew 'adds the first 4 columns
----
---
---
.update
I read around 700 rows from one table and Insert around 700 rows every day.
I'd agree with tom, the problem is more likely your application than the table. Look at ways you could speed the process from the application end. You could use prepared statements, stored procedures, or try to break you code out to different layers.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.