Note that there are some explanatory texts on larger screens.

plurals
  1. POTable searches fast on local SQL Server but slow on host SQL Server
    primarykey
    data
    text
    <p>I have a SQL Server 2008 database with a table that contains about a 100,000 rows, I have setup all the correct indexes and primary keys and Full Text Search and made sure its fine tuned.</p> <p>I created a stored procedure that searches a nvarchar column in the table, the SP is long and has multiple select / insert statements.</p> <p>Now when I run the SP on my local SQL Server I get the result in one second, then I backed up the database and restored it on another machine and tried the same search and I got it in one second.</p> <p>My problem is when I create the database in my hosts shared SQL Server and import all the data from my SQL Server and run the search I get the result in 7 seconds! although I made sure I have the same indexes and primary keys and FTS working.</p> <p>The only difference in my database in the hosts sql server is that I created the schema using a script then I imported all the data using the import/export wizard, so to check if this is whats causing this problem I created a new database on my machine and imported the data using the wizard, and I got the search result in 3 seconds!</p> <p>I checked the execution plan of the SP in the database on the hosts SQL Server and found one index scan is taking 49% of the cost while on my machine it was 0%</p> <p>Can somebody please point out why this is happening?</p> <p>Thanks.</p> <p>EDIT: </p> <p>Now when I run the execution plan for both servers I get exactly the same plan and costs, but still the speed difference is huge (1 second and 7 seconds).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload