consulta muy lenta después de reindexar tablas.

I recently reindexed some of my tables with half a million records in it. this is the first time we reindexed those tables. most of the stuff seeems to work faster except one User defined function which gets stuck and doesnt return anything. i tried to play around with that query and turned it into a simple query and even that takes alot of time to come up.

i tried all options that i found while browing through differnet forums. I tried rebuilding,reorganizing indexes, update statistic with and without fullscan, recompiled all procedures. even created a table from scratch and put those index on it and copied data from original table. but the problem persists.

this was working fine before we reindexed those tables. i used simple dbcc dbreindex command with 80 fillfactor to reindex them. database file grew almost double after reindexing and log file remained almost same. Database autogrowth option set to default 10%. recover mode is 'simple'

btw, this query that fails to come up after reindexing uses lot of subqueries in select field list. i.e. select customer.name, (select orders.orderId from orders where order.customerid = customer.id) as orderid etc. just an example but something like that. does this make any difference?

can somebody please try to help on this issue. thanks very much in advance.

preguntado el 27 de agosto de 11 a las 17:08

Q: Can you show us the simple query? Q: have you analyzed the query with show plan or show plan all? Q: Which version of SQL server are you running? MSSQL 2008 Enterprise? And remember - no amount of indexing in the world will help if your query's doing a full table scan :) Please cut/paste your simplified query that shows the problem, if at all possible. -

Also: this link talks about a common mistake - doing an "update statistics" right after "rebuild index": sqlservercentral.com/Forums/Topic504420-146-1.aspx Search for "worst practice" near the bottom of the thread. -

query plan is the way to go, despite what you may think it sounds like a missing index -

Agreed - query plan IS the way to go. It's worth emphasizing, however, that all this reindexing and recompiling have probably thrown the statistics out of whack, and the optimizer might (temporarily!) be making bad judgements because of bad statistics. STOP changing anything, and EMPEZAR analyzing the query plans. Here's a good link (one of many): sqlserverpedia.com/wiki/Examining_Query_Execution_Plans -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.