Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8358201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:43:20+00:00 2026-06-09T10:43:20+00:00

The following queries run in an sproc targeting the ItemData table in SQL Server

  • 0

The following queries run in an sproc targeting the ItemData table in SQL Server 2008R2:

SELECT TOP(500) ItemListID, GeoCity, GeoState, GeoDisplay, Title, Link, Description, CleanDescription, OptimizedDescription, PubDateParsed, ImageBytes, DateAdded  FROM  (      SELECT TOP(500) ItemListID, GeoCity, GeoState, GeoDisplay, Title, Link, Description, CleanDescription, OptimizedDescription, PubDateParsed, ImageBytes, DateAdded, ROW_NUMBER()             
       OVER( ORDER BY ItemListID DESC )
       AS RowNumber  
       FROM ItemData  
       WHERE CONTAINS(Title, @FTSSearchTerm  ) -- ' + @OriginalSearchTerm + '"')   
       AND  ( WebsiteID=1 AND 
                                     (@GeoCity = '-1' OR GeoCity = @GeoCity)  AND
                                     (@GeoState = '-1' OR GeoState = @GeoState) )
                   ) ItemData   WHERE RowNumber >= ( @PageNum - 1) * @PageSize + 1   AND RowNumber <= @PageNum * @PageSize ORDER BY ItemListID DESC 

        SELECT @NumberOfResultsReturned = @@ROWCOUNT         

        SELECT @ActualNumberOfResults = COUNT(*) FROM ItemData WHERE CONTAINS(Title, @FTSSearchTerm  ) -- ' + @OriginalSearchTerm + '"')    AND  ( WebsiteID=1 AND       (@GeoCity = '-1' OR GeoCity = @GeoCity)  AND    (@GeoState = '-1' OR GeoState = @GeoState) )

Depending on the data the query uses either CONTAINS or FREETEXT.

With load this query runs very slow and peeks the server at 100%.

I have set the following indexes:

enter image description here

What do I need to do so these queries stop running so hot?

Thanks.

— UPDATE —

The table has one clustered index which only consists of ItemListID, and FTS on Title and Description.

I have added a non-clustered index (incorrectly named in the Identity name) as follows:

Non-clustered indexes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:43:21+00:00Added an answer on June 9, 2026 at 10:43 am

    Without actually looking into the execution plan, it seems like you need a non-clustered index on Title, GeoCity, GeoState, and WebsiteID with the following include columns: ItemListID, GeoDisplay, Link, Description, CleanDescription, OptimizedDescription, PubDateParsed, ImageBytes, DateAdded

    This will allow the execution plan to use the one non-clustered index that contains all of the information you are looking for in this query. Without it, it will use one of the indexes you showed and still have to go to the table to get the data you need.

    This won’t totally fix your problem though, depending on how much data is in your table, doing the Contains on Title to do searching will always be expensive. It would be best if you could leverage full text searching to do the searching portion.

    Hopefully this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following VBA subroutine will run most queries just fine. (ie: SELECT * FROM
I can easily see a list of recently run queries using the following SQL:
I run following queries : a. select * from TABLE_TEMP The query is executed
The following queries update the same table like 7 times.. I would appreciate your
I have tried following queries to get my facebook fan page insights data SELECT
I have the following two queries. SELECT account_name,SUM(amount) AS AMOUNT1 FROM entries LEFT JOIN
I have the following two queries: select count(*) from segmentation_cycle_recipients scr , segmentation_instance si
I have the following queries, QryStockOnHand SELECT QrySaleTot.Item, QrySaleTot.ProductID, [QryStockLevel].[Stock]-[QrySaleTot].[Quantity] AS StockOnHand FROM QryStockLevel
I would like to have an easy way to run queries like the following
I have the following SQL Server 2008 query that works for all of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.