Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I utilize Indexing when querying?

Status
Not open for further replies.

HoustonGuy

Programmer
Jun 29, 2000
165
0
0
US
I have quite a few heavy queries I'm running against a production server.

A few points:
I'm not a fan of NOLOCK in this instance, since I can get dirty reads.
I don't have Group by, or Order by clauses that might benefit from referencing an indexed field.
I do have Where clauses, but most of them aren't referencing Indexed fields.
I'm performing basic Selects, Inserts and Updates.

Is there a way in my queries that I can optimize performance?
I can't find a Hint that would seem to help my optimization efforts.

I know optimization is a big area of discussion, and my question seems vague, but I haven't found anything else to try in my code to help.

Many thanks in advance! :)
 
Why don't you post some code so we can take a look. Specifically, if you post the query, the execution plan, and the existing indexes, we may be able to make some recommendations that will help you with your indexing strategy.

To get the query plan, do this:

Code:
SET SHOWPLAN_TEXT ON
GO
-- Put your query here

Before running the query, set the output to text. To do this, right click in the query window, click Query Options, click Results -> Text. Set Masimum number of characters displayed in each column to 8000. Click ok. Next, right click the query window again, click Results To -> Results To Text

Now run the query.

To show the existing indexes for a table...

Code:
sp_helpindex 'Table Name here'

Whatever optimization tips you learn for one query will likely be applicable to other queries too.


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Unfortunately I don't have SHOWPLAN execution rights. Still waiting for that. (Don't ask, it's a quagmire!) LOL
When I do I can post more.
Many thanks, however.
 
We still may be able to help if you show the query and the indexes.


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top