In a previous post I discussed using the slxprofiler to find bottlenecks in SalesLogix sql statements. Today we will examine one query and create an Index with the Database Engine Tuning Advisor. Before you began this procedure keep in mind these new indexes can be over 200mb so make sure you have adequate drive space. This will not increase the performance on Remote Databases. I also recommend backing up the db before applying any new query.
Open up SQL Server Management Studio and paste your script from slxprofiler into a new query - run this query against your SalesLogix DB. Here is an example.
SELECT A1.HISTORYID FROM HISTORY A1 INNER JOIN PICKLIST A2 ON (A1.TYPE=A2.ID) WHERE (((A1.TYPE<>262162) OR (A1.USERID='U0CRFA00000E')) AND (A1.OPPORTUNITYID IS NOT NULL AND A1.OPPORTUNITYID <> '')) AND (A1.OPPORTUNITYID = '123') AND (A1.TYPE <> 262156) Order By A1.COMPLETEDDATE Desc ,A1.HISTORYID
If there are any question marks in the query replace those with double quotes and some sample data. In the query above I replaced a ? for opportunityid with '123'. Then from the Query menu select Analyze Query in Database Engine Tuning Advisor. The Advisor with date stamp your session so your next step is to select your database on the general tab. Leave the Tuning Options at the defaults and click on Start Analysis. Once the Progress tab shows completed and Recommendations are produced, select all recommendations and then from the Actions menu Save Recommendations. Now you will have a query that you will run against your db in Query analyzer.