resident
یک شنبه 23 تیر 1398, 16:15 عصر
سلام.
من میخوام یه سرچ کلی روی جداولم انجام بدم. حدودا 250 تا جدول دارم.
من اینطوری کوئری میزنم:
select count(*)
from table1
where field1 like N'%searchKeyword%' or field1 like N'%searchKeyword%' or field1 like N'%searchKeyword%' or field1 like N'%searchKeyword%' or ...
union all
select count(*)
from table2
where field11 like N'%searchKeyword%' or field12 like N'%searchKeyword%' or field13 like N'%searchKeyword%' or field14 like N'%searchKeyword%' or ...
union all
select count(*)
from table3
where field21 like N'%searchKeyword%' or field22 like N'%searchKeyword%' or field23 like N'%searchKeyword%' or field24 like N'%searchKeyword%' or ...
union all
.
.
.
نو این روش با توجه به تعداد فیلدهای زیاد جداول ، وقتی تعداد دیتاها زیاد میشه سرعت سرچ میاد پایین.
کسی پیشنهادی داره؟ روش بهینه ای سراغ دارین؟
من میخوام یه سرچ کلی روی جداولم انجام بدم. حدودا 250 تا جدول دارم.
من اینطوری کوئری میزنم:
select count(*)
from table1
where field1 like N'%searchKeyword%' or field1 like N'%searchKeyword%' or field1 like N'%searchKeyword%' or field1 like N'%searchKeyword%' or ...
union all
select count(*)
from table2
where field11 like N'%searchKeyword%' or field12 like N'%searchKeyword%' or field13 like N'%searchKeyword%' or field14 like N'%searchKeyword%' or ...
union all
select count(*)
from table3
where field21 like N'%searchKeyword%' or field22 like N'%searchKeyword%' or field23 like N'%searchKeyword%' or field24 like N'%searchKeyword%' or ...
union all
.
.
.
نو این روش با توجه به تعداد فیلدهای زیاد جداول ، وقتی تعداد دیتاها زیاد میشه سرعت سرچ میاد پایین.
کسی پیشنهادی داره؟ روش بهینه ای سراغ دارین؟