Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Popular Posts

Tags

2008 2008 Express Add AFTER alert Alias Aliases Alter Alternating And ASC Assist BETA Blog Cancel Check ON Checkbox Checkbox Group Color Column Columns Combo Box Composite Confirm Confirm Message Control CREATE CREATE TABLE Data Data Springs Database DDL DELETE Delete Confirm Demo Demonstration DESC Direct Access DNN DotNetNuke Drop Drop Constratint Drop Down Drop Down List DS Dynamic Dynamic Blog Dynamic Forms Dynamic Registration Dynamic Views Edit Event Example Express Fade In Fade Out Field Filters FK Forms Full-Table Scan Generating Generator Generators Great Ideas Group Help HTML Increase Index Indexes Input Integrity jQuery Label Listbox Listener Message Modify My Account MySQL No NULL Often Ok ON Optimization Optimize Option Options Oracle Order By Perform Performance PK Popup PostreSQL Queries Query QuestionOptionValue Radio Button Radio Button Group References referential Round Script Search Search Filters SearchOption SearchOptionValue Select Server Snippet Sort Springs SQL SQL Driven SQL Driven Query SQL Express SQL Server SQL Server 2005 SQL Server 2008 SQL Server 2008 Express SQL Server 2008 R2 SQL Server Express SSMS Stored Stored Procedure TABLE Tables Temporary Tool Tools Tooltip Tooltips Transact-SQL Trials Triggers TSQL T-SQL Unique UPDATE Use Useful Views Widget Widgets Window Yes [userimage] 10 64 bit Ability ABS Action Active Forums Alleviate Alternating Colors Alternating Rows Analytics ARB asp.net asp.net validation AuthARB Authorize.NET Avoid Back Button Basecamp Blog Blog Posts Blogging Browser Browser Back Browser Close Browser History Browser Script Button cascading style sheet Case Char Character CharAt CharAt() Check chip levinson Click client side validation Close Browser Close Window Collection 5.0 Comment Compatibility Compatible Completion completion event Confirm Message Conform Constraints content localization Count Timer Countdown CRM css csv Cursor Custom Custom HTML Custom JavaScript Custom JavaScript File customer feedback Customize Data Data Integrity Data Springs Data Springs Blog Data Springs Collection Data Springs Development Data Springs Planning Data Springs Training Databases DataSprings Date Time JavaScript Debug Info default value Delete Demonstration DF DNN DNN Authentication DNN Blog DNN Core Profile Property dnn html module dnn modules dnn schedule error dnn schedule multiple DNN Store document document.getElementById DotNetNuke dotnetnuke 5.4.4 DotNetNuke Analytics DotNetNuke Forums DotNetNuke JavaScript DotNetNuke Modules dotnetnuke reporting dotnetnuke scheduler dotnetnuke user image Double Double Quotes DR DROP Drop Constraint DropDown Login DS dynamic Dynamic Data dynamic fields Dynamic Form Dynamic Forms dynamic forms silent post Dynamic Forms Tutorial dynamic login Dynamic PDF Form Completion Event dynamic registration dynamic registration silent post dynamic registration user image dynamic user directory dynamic views DynamicRegistration_Question DynamicRegistration_QuestionResponse email email issues Encapsulated Encapsulation Even Event Event Viewer Example Excel Execute Export Export to Excel Facebook Facebook Connect Field FieldID First FirstName Fix Foreign Key Form Form Post Formatting Forms Forum Flow Full Table Scan Fully Function Google Analytics Google Analytics Ecommerce Great Great ideas Grid guides hidden field Hide Show Rows Highrise Highrise API Hourly Services HTML HTTP Post iDeal IE IE 10 Image Image Button Include Inconsistancy Info Information Injection INSERT Integration Interactive User Import Interface internet Internet Explorer iPAD iPAD App for Highrise iPAD Highrise App Items JavaScript JavaScript hide show JS Function Layout Lead Generation Learn Left Left Quote Link LinkedIn list import Live Blog localization Log Logic Login login module login skin object Loop Mandeeps Match Message Microsoft Live Writer module configuration Modules Monthly Services Name Netherlands New News Blog NL NOT NULL oAuth2 Odd OnClick Open Web Studio opt in email OWS Part 1 Part 2 Passed payment gateway paypal Phone Number Placement Post Postback Posts Premium Integration Premium Services Premium Support Primary Key Procedure Products profile Quarterly Services Question question fields Question Loop Question Value QuestionOption Quick Quotes Recommend Recommendation Recurring Billing Redirect Referential Integrity registration Rendered Replace replace html text report views reports Resolution Resource resource files resx Retrieve Retrieving Right Right Quote Rows Ryan Bakerink Sales Force SalesForce Script Scripting Scripts Sequential Access server side validation Silent Post Single Single Quotes Single Sign On skin object Snowcovered Solution sp Springs SQL sql 2005 pivot sql default value SQL Example sql import SQL Injection sql query sql replace statement sql reports SQL Server sql server 2005 SSL SSO stored stored procedure String style sheet stylesheet Submit Submit Button Submit Image Submit Link success story Suggest Suggestion Support Syntax Table technical techwise research Temp test credit card numbers testimonial Text/HTML thumbnail image Time Timer Tip Token Topic Transaction Trial Trigger TSQL T-SQL Tutorial Twitter Types of Constraints Unique Update Highrise user user directory user profile image users online Variable View Web Based Work Around writer writing xls xlsx XML

In the Flow

rss

Data Springs, Inc. - An online diary and web log from staff and customers for premium DotNetNuke resources, Data Springs Modules, and Data Springs Services.


SQL Server Indexes

Data Retrieval Methods within databases:

Method 1: Sequential access method, by searching through each individual record looking for a match. Unindexed table AKA Full-table scan

Method 2: Direct Access Method. Use of Index(es) on a table.

What are Indexes?

An Index is a way of presenting data differently than the way it appears on the disk(within a SQL Table). Special types of Indexes reorder the records physical location within a table. An index can be created and assigned to a single column or multiple columns depending on your database implementation and what’s supported by your RDBMS.

An Index is very similar to the Order by clause however the key differences are:

  • Order By Clause Re-sorts and orders the data each time you execute the corresponding SQL Statment.
  • When using an Index, the database system creates a physical index object and reuses the same index each time you query the table.

*** Please note that SQL indexes require physical storage and resides on the disk hard drive.

Is there an appropriate and inappropriate time to use indexes?

The answer is yes. Indexes exist to assist with query optimization. Indexes if used incorrectly can cause additional overhead to your query. It’s important to analyze your Table and understand the best and worst case to use/remove an index.

Appropriate times to use Indexes:

  • Indexes yield the greatest improvement when the columns you have indexed contain a wide variety of data.
  • Indexes can optimize your queries when those queries are returning a small amount of data
  • Always index fields that are used in joins between tables. This technique can greatly increase the speed of a join.

Inappropriate times to use Indexes:

  • Indexes can improve the speed of data retrieval, however they cause slow data updates. When performing large inserts, updates, deletes, you may want to drop the index before doing so and adding it back after success.
  • For small tables, the use of indexes does not result in any performance improvement.
  • Indexes should not be used on columns that contain high number of NULL values.
  • Do not index on fields that are manipulated frequently. This will result with additional overhead.
  • Indexes take up space within your database. If you’re trying to manage space, then be aware of the space being allocated and used by your indexes.

Why would you use an Index?

Indexes are typically used for three primary reasons:

1.) To enforce referential integrity.
2.) To facilitate the ordering of data based on the contents of the indexes field or fields.
3.) To optimize the execution speed of queries.

Syntax to Create Indexes on SQL Server:

CREATE INDEX NameOfIndex
ON TableName(Column1)

You also have the capability to store the column information in ASC or DESC order. Indexes help sort all of the information in the tablebased on the column you’re sorting on.

CREATE INDEX NameOfIndex
ON TableName(Column1 ASC)
-- No need to specify ASC for ascending order since this is the default behavior.

CREATE INDEX NameOfIndex
ON TableName(Column1 DESC)
-- Sort the column information in descending order.

NOTE: It’s practical to create an index on the primary key or key columns in your table that link you to other tables.

Composite Indexes:

You can also create indexes on more than one column. This is called a Composite index or a covering index.

Here’s the Syntax:

CREATE INDEX IndexName
ON TableName (Column1, Column2)

Composite indexes are usually used with the UNIQUE keyword to rectify columns with unique data. As described earlier, it’s best to use Indexes on columns of a table with unique values.

CREATE UNIQUE INDEX IndexName
ON TableName(Column1, Column2)

 

Syntax to Drop Indexes on SQL Server:

To drop an index you will use the following syntax:

DROP INDEX NameOfIndex
ON TableName

NOTE: When a table is dropped, all indexes associated with that table is/are dropped.

 

Disadvantages to Indexes:

1.) Requires additional storage space
2.) Indexes require maintenance
3.) Performance decreases with Data Updates(Insert, Update, delete)




Comments are closed.

Recent Comments

 
 

Join our mailing list...

Get current news and events the easy way
 
 
   
Subscribe Me

Recent Blogs...

 
Copyright 2005 - 2011 by Data Springs, Inc.