dteshome
asked on
Query that immobilizes the dev server
Please help figure out why query is making server "non-responsive" extreemly slow, have to reboot everytime I run this update stmt that a developer is running in Dev.
--
Facts: # of recs in tables
select * from themls_offices -- 93414
--
SELECT COUNT(*) -- 69684
from [devdb.helios.themls.com]. [mls].[dbo ].[all_car ets_office s] ACO
--
Is the update below checking/reading 6,557,849,628
(69684 X 70202 recs)??
I say this because it appears to be the case from the query and when run, it brings down the dev server (extreemly slow, non responsive)
update themls_offices
set CARETS_OfficeID = AgentOfficeID
from [devdb.helios.themls.com]. [mls].[dbo ].[all_car ets_office s] as ACO
where firmCode = cast(ACO.MlsOfficeid as varchar(30))
--
--**I replaced above query by one below - is it equivalent? (FirmCode and CARETS_OfficeID belong to themls_offices ...)
update themls_offices
set CARETS_OfficeID = aco.AgentOfficeID
from [devdb.helios.themls.com]. [mls].[dbo ].[all_car ets_office s] ACO
inner join themls_offices MO
on MO.firmCode = cast(ACO.MlsOfficeid as varchar(30))
--*
I expected 69684 recs to be update (see below)
However, the query is taking over 30 min to run. still running
(maybe becasue it is going accross servers - linked server ??)
SELECT COUNT(*) -- 69684
from [devdb.helios.themls.com]. [mls].[dbo ].[all_car ets_office s] ACO
inner join themls_offices MO
on MO.firmCode = cast(ACO.MlsOfficeid as varchar(30))
--*
--
Facts: # of recs in tables
select * from themls_offices -- 93414
--
SELECT COUNT(*) -- 69684
from [devdb.helios.themls.com].
--
Is the update below checking/reading 6,557,849,628
(69684 X 70202 recs)??
I say this because it appears to be the case from the query and when run, it brings down the dev server (extreemly slow, non responsive)
update themls_offices
set CARETS_OfficeID = AgentOfficeID
from [devdb.helios.themls.com].
where firmCode = cast(ACO.MlsOfficeid as varchar(30))
--
--**I replaced above query by one below - is it equivalent? (FirmCode and CARETS_OfficeID belong to themls_offices ...)
update themls_offices
set CARETS_OfficeID = aco.AgentOfficeID
from [devdb.helios.themls.com].
inner join themls_offices MO
on MO.firmCode = cast(ACO.MlsOfficeid as varchar(30))
--*
I expected 69684 recs to be update (see below)
However, the query is taking over 30 min to run. still running
(maybe becasue it is going accross servers - linked server ??)
SELECT COUNT(*) -- 69684
from [devdb.helios.themls.com].
inner join themls_offices MO
on MO.firmCode = cast(ACO.MlsOfficeid as varchar(30))
--*
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tx
Dan