MsSQL 2005 query performance
- by Max
I have the following query:
select .............
from
//one table and about 20 left joins//
where
(
(
this_.driverName like 'blah*'
or this_.renterName like 'blah*'
)
or exists (
select
this0__.id as y0_
from
ThirdParty this0__
where
this0__.name like 'blah*'
and this0__.claim_id=this_.id
)
)
order by
this_.id asc
And I have two environment:
One with 175 000 records in table "this_" and
second with 25 000 records in table "this_".
This query works right on 175k database and it works smth about 2 seconds, but on base with 25k this query freezes.
and if drop one the folloing item from where clause:
(
this_.driverName like 'blah*'
or this_.renterName like 'blah*'
)
or
exists (
select
this0__.id as y0_
from
ThirdParty this0__
where
this0__.name like 'blah*'
and this0__.claim_id=this_.id
)
query runs normally.
How can I to increase performance of this query?