我有这个问题:
SELECT `o`.`fruits_id`
FROM `fruits` as `o` JOIN `fruits_categories` as `oc` ON `o`.`fruits_id` = `oc`.`fruits_id`
JOIN `categories` as `c` ON `c`.`cat_id` = `oc`.`cat_id`
JOIN `fruits_location` as `ol` ON `o`.`fruits_id` = `ol`.`fruits_id`
JOIN `location` as `l` ON `l`.`location_id` = `ol`.`location_id`
JOIN `fruits_price` as `op` ON `o`.`fruits_id` = `op`.`fruits_id`
JOIN `price` as `p` ON `p`.`price_id` = `op`.`price_id`
WHERE ( (MATCH (c.cat_name) AGAINST ('apple') OR MATCH (l.location_name) AGAINST ('apple') OR MATCH (o.fruits_name, o.fruits_description, o.address, o.instagram_tag) AGAINST ('apple') OR MATCH (p.price_name) AGAINST ('apple') )
AND (MATCH (c.cat_name) AGAINST ('orange') OR MATCH (l.location_name) AGAINST ('orange') MATCH (o.fruits_name, o.fruits_description, o.address, o.instagram_tag) AGAINST ('orange') OR OR MATCH (p.price_name) AGAINST ('orange') ) ) LIMIT 9
当我在phpmyadmin中运行时,处理大约需要3秒钟,我觉得这很好。
但是当我在PHP文件中运行它(结果分页)时,完成需要大约11秒。
我猜测仍然有一个更优化的查询可以实现结果。
谢谢,我感谢任何帮助。
乙