Hi,
I had someone make me a site with a query thats very slow and he does not know how to fix it, the table has been indexed and if i run a query directly to that one table it runs quickly however in its join statement that was made its VERY slow and the query needs to handle 2million records and it cant even handle 50k! below is the query(its not in a SP, but in the actual source file) and also attached is a screenshot of the estimated execution plan. Also the query dynamically changes based on different user settings via asp.
SELECT MPS.merchant_key, [login to view URL], [login to view URL] MERCHANT_RATING, [login to view URL], [login to view URL], [login to view URL], [login to view URL] MERCHANT_NAME, [login to view URL], MPS.PRODUCT_NAME, [login to view URL], [login to view URL] CATEGORY, MPS.SHORT_DESCRIPTION, MPS.IMAGE_URL, ISNULL([login to view URL], [login to view URL]) CPC, [login to view URL] AS MERCHANT_CPC FROM MERCHANT_PRODUCTS_SEARCH MPS, MERCHANT_PRODUCTS_SEARCH_CPC MPS_CPC, MERCHANTS M, (select sum(value) ratings, count(*) total, merchant_key from consumer_ratings where value is not null group by merchant_key) as rating WHERE MPS.MERCHANT_KEY *= rating.merchant_key AND MPS.MERCHANT_KEY *= MPS_CPC.MERCHANT_KEY AND [login to view URL] *= [login to view URL] AND [login to view URL] *= [login to view URL] AND [login to view URL] *= [login to view URL] AND MPS.merchant_key = M.merchant_key AND [login to view URL] = 1 AND [login to view URL] > 0 AND [login to view URL] like '%louis%vuitton%' ORDER BY CPC DESC
you can test current speed at
<[login to view URL]>
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
SQL Server/ASP/INDEXES