-5
select 
   c.std_date,c.conf_link,c.conf_link as 
   link,c.conf_id,c.url_id,c.entry_source,c.data_source,c.title,c.conf_domain,
   c.descrip, c.std_loc, c.std_practices,c.region, co.company_id,co.company,co.home_url 
from 
   conferences c, companies co 
where c.org_id= co.company_id and c.org_id in   
    (12,47,173,120,102,83,95,172,200,78,199,523,134,123,30,185,103,202,
     159,133,178,49,161,146,17,212,136,43,107,147,142,3, 205,171,177,443,175,74,156,41,42,128,5,7,62,37,195,68,89,8,39,85,126,36,24,206,208,201,150,152,168,59,97,28,11,116,140,98,117,51,174,93,192,50,617,176,101,194,527,61,179,170,145,40,92,257,149,48,88,486,20,111,106,203,19,31,163,81,25,38,623,628,642,643,644,645,647,677,711,712,713,6173,6174,6176,6177,6184,6185,6186,6189,6191,6207,6210,6211,6212,6214,6215,6217,6218,6219,6222,6223,6224,6294,6297,6298,6300,6301,6302,7468,7469,7471,7472,7473,7474,7475,7476,7477,7478,7479,7480,7481,7482,7483,7484,7489,7490,7491,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,7503,7504,7505,7506,7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519,7520,7521,7522,7523,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551,7552,7553,7554,7555,7556,7557,7558,7559,7560,7562,7566) 
and conf_id !='' and (region !='123' and region not like 'webinar%') and std_date >= '2013-04-17' and std_date <= '2013-04-24' and (data_source like 'E%' OR data_source like 'A%') and region != '' and org !='' and title not like '%groupcast%' and relevance >= 0 order by std_date desc limit 3500
4

2 回答 2

2

这应该是你需要的。您不必id手动输入 s

where c.org_id= co.company_id and c.org_id in (Select id from Conferences)
于 2013-04-17T21:58:55.703 回答
1

好吧,这很容易:

  • 先看“解释……”

  • 看,是什么导致了太多的行

  • 重新制定以获得更好的结果。

尽管有日期范围,我看不到真正的限制。std_date 是日期时间字段吗?然后添加时间 00:00:00 可能会有所帮助(如果有任何索引的话)。我也更喜欢内部连接,

从会议 c
内部加入公司 co on c.org_id= co.company_id

但这不会提高速度。

“喜欢……”,尤其是“不喜欢……”是嫌疑犯。

如果只有一个候选者(如果该字段上有任何索引,则使用索引),如果像 E% 或像 A% 这样的条件要快得多,请尝试 - 然后对两个单个查询进行 UNION。

“data_source like” 可以从 text-index 中获得一些帮助。

于 2013-04-17T22:04:28.157 回答