我想了解我的symfony项目中的一个小问题。
数据库非常简单:
制品
--id
--name
塔里夫
--id
--idarticle
--seuil (threshold)
--prix (price)
--devise (currency)
我想通过此查询选择所有我的文章,其价格为欧元:
Doctrine_Query::create()->from('article')
->innerJoin('article.Tarif tarif')
->where('tarif.devise = ?', '0')
->execute();
但是在调试页面中我有超过300个查询,主查询:
SELECT a.id AS a__id, a.lot AS a__lot, a.ref AS a__ref, a.reflama AS a__reflama, a.refoem AS a__refoem, a.designation AS a__designation, a.idfamille AS a__idfamille, a.idcategorie AS a__idcategorie, a.couleur AS a__couleur, a.contenance AS a__contenance, a.poids AS a__poids, a.nbpages AS a__nbpages, a.etat AS a__etat, a.pack AS a__pack, a.pcb AS a__pcb, t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM article a INNER JOIN tarif t ON a.id = t.idarticle WHERE (t.devise = '0')
还有很多其他的:
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '2')
0.00s, "doctrine" connection
SELECT t.id AS t__id, t.idarticle AS t__idarticle, t.seuil AS t__seuil, t.prix AS t__prix, t.devise AS t__devise FROM tarif t WHERE (t.idarticle = '3')
0.00s, "doctrine" connection
如何删除所有这些无用的查询?