Query Metrics
5
Database Queries
5
Different statements
104.21 ms
Query time
1
Invalid entities
Grouped Statements
idempiere connection
| Time▼ | Count | Info |
|---|---|---|
|
54.78 ms (52.57%) |
1 |
WITH base AS ( SELECT mpp.m_product_id, mpp.m_pricelist_version_id, mpp.m_productprice_id, mpp.pricestd, mpp.pricelist, mpp.pricelimit, mpp.pricepoamt, mpp.qtyonhand, mpp.sm_precio_estimadoline_id, p.name, p.comercialname, p.sku, p.value, sm.sm_marca_id AS marca_id, sm.name AS marca_name, q.qty_func AS qty_function, r.reserved_in_templates, a.on_arrive, -- estimación efectiva: primero la del price, si no existe usa la última aprobada del producto COALESCE(spel.pricestd, est.pricestd) AS price_break, COALESCE(spel.updated, est.updated) AS updated, COALESCE(mpp.sm_precio_estimadoline_id, est.id) AS sm_precio_estimadoline_id, imgs.image_urls, mpp.m_productprice_uu, sm.sm_marca_id, p.description, p.upc, -- suma simple, por si la quieres mostrar (COALESCE(q.qty_func,0) + COALESCE(r.reserved_in_templates,0) + COALESCE(a.on_arrive,0)) AS qty_sum, -- disponible (onhand - reservas + llegadas) (COALESCE(q.qty_func,0) - COALESCE(r.reserved_in_templates,0) + COALESCE(a.on_arrive,0)) AS qty_available FROM adempiere.m_pricelist mpl JOIN adempiere.m_pricelist_version mplv ON mplv.m_pricelist_id = mpl.m_pricelist_id JOIN adempiere.m_productprice mpp ON mpp.m_pricelist_version_id = mplv.m_pricelist_version_id JOIN adempiere.m_product p ON p.m_product_id = mpp.m_product_id JOIN adempiere.sm_marca sm ON sm.sm_marca_id = mpp.sm_marca_id -- qty on hand (una vez por fila) CROSS JOIN LATERAL ( SELECT adempiere.bomqtyonhandtoorder(mpp.m_product_id, 0, 0) AS qty_func ) q -- reservas (plantillas) LEFT JOIN LATERAL ( SELECT COALESCE(SUM(ml.qty),0) AS reserved_in_templates FROM adempiere.sm_salestemplateline ml JOIN adempiere.sm_salestemplate mr ON mr.sm_salestemplate_id = ml.sm_salestemplate_id WHERE ml.m_product_id = mpp.m_product_id AND mr.docstatus IN ('DR','IP','AP') ) r ON TRUE -- en camino (OC confirmadas) LEFT JOIN LATERAL ( SELECT COALESCE(SUM(ol.qtyreserved),0) AS on_arrive FROM adempiere.c_orderline ol JOIN adempiere.c_order o ON o.c_order_id = ol.c_order_id WHERE o.issotrx='N' AND o.docstatus='CO' AND ol.qtyreserved<>0 AND ol.m_product_id = mpp.m_product_id ) a ON TRUE -- imágenes LEFT JOIN LATERAL ( SELECT json_agg(img.downloadurl ORDER BY img.downloadurl) AS image_urls FROM adempiere.m_productdownload img WHERE img.m_product_id = mpp.m_product_id ) imgs ON TRUE -- línea de estimado ligada al price (si existe) LEFT JOIN adempiere.sm_precio_estimadoline spel ON spel.sm_precio_estimadoline_id = mpp.sm_precio_estimadoline_id -- fallback: última línea de estimado aprobada para este producto LEFT JOIN LATERAL ( SELECT spel2.sm_precio_estimadoline_id AS id, spel2.pricestd, spel2.updated FROM adempiere.sm_precio_estimadoline spel2 JOIN adempiere.sm_precio_estimado spe2 ON spe2.sm_precio_estimado_id = spel2.sm_precio_estimado_id WHERE spel2.m_product_id = mpp.m_product_id AND spe2.docstatus = 'Y' ORDER BY spel2.sm_precio_estimadoline_id DESC LIMIT 1 ) est ON TRUE WHERE mplv.isweb = 'Y' ) SELECT * FROM base b WHERE b.m_product_id NOT IN (:exclu_0, :exclu_1, :exclu_2) AND LOWER(CONCAT_WS(' ', b.name, b.comercialname, b.sku, b.value)) LIKE :q AND b.marca_id = :marca_id AND (COALESCE(b.qty_function,0) - COALESCE(b.reserved_in_templates,0) + COALESCE(b.on_arrive,0)) > 0 ORDER BY b.name ASC LIMIT :limit OFFSET :offset
Parameters:
[ "limit" => 3 "offset" => 0 "exclu_0" => 1001319 "exclu_1" => 1001101 "exclu_2" => 1001103 "q" => "%gphn1001637%" "marca_id" => 1000000 ] |
|
28.06 ms (26.93%) |
1 |
WITH base AS ( SELECT mpp.m_product_id, mpp.m_pricelist_version_id, mpp.m_productprice_id, mpp.pricestd, mpp.pricelist, mpp.pricelimit, mpp.pricepoamt, mpp.qtyonhand, mpp.sm_precio_estimadoline_id, p.name, p.comercialname, p.sku, p.value, sm.sm_marca_id AS marca_id, sm.name AS marca_name, q.qty_func AS qty_function, r.reserved_in_templates, a.on_arrive, -- estimación efectiva: primero la del price, si no existe usa la última aprobada del producto COALESCE(spel.pricestd, est.pricestd) AS price_break, COALESCE(spel.updated, est.updated) AS updated, COALESCE(mpp.sm_precio_estimadoline_id, est.id) AS sm_precio_estimadoline_id, imgs.image_urls, mpp.m_productprice_uu, sm.sm_marca_id, p.description, p.upc, -- suma simple, por si la quieres mostrar (COALESCE(q.qty_func,0) + COALESCE(r.reserved_in_templates,0) + COALESCE(a.on_arrive,0)) AS qty_sum, -- disponible (onhand - reservas + llegadas) (COALESCE(q.qty_func,0) - COALESCE(r.reserved_in_templates,0) + COALESCE(a.on_arrive,0)) AS qty_available FROM adempiere.m_pricelist mpl JOIN adempiere.m_pricelist_version mplv ON mplv.m_pricelist_id = mpl.m_pricelist_id JOIN adempiere.m_productprice mpp ON mpp.m_pricelist_version_id = mplv.m_pricelist_version_id JOIN adempiere.m_product p ON p.m_product_id = mpp.m_product_id JOIN adempiere.sm_marca sm ON sm.sm_marca_id = mpp.sm_marca_id -- qty on hand (una vez por fila) CROSS JOIN LATERAL ( SELECT adempiere.bomqtyonhandtoorder(mpp.m_product_id, 0, 0) AS qty_func ) q -- reservas (plantillas) LEFT JOIN LATERAL ( SELECT COALESCE(SUM(ml.qty),0) AS reserved_in_templates FROM adempiere.sm_salestemplateline ml JOIN adempiere.sm_salestemplate mr ON mr.sm_salestemplate_id = ml.sm_salestemplate_id WHERE ml.m_product_id = mpp.m_product_id AND mr.docstatus IN ('DR','IP','AP') ) r ON TRUE -- en camino (OC confirmadas) LEFT JOIN LATERAL ( SELECT COALESCE(SUM(ol.qtyreserved),0) AS on_arrive FROM adempiere.c_orderline ol JOIN adempiere.c_order o ON o.c_order_id = ol.c_order_id WHERE o.issotrx='N' AND o.docstatus='CO' AND ol.qtyreserved<>0 AND ol.m_product_id = mpp.m_product_id ) a ON TRUE -- imágenes LEFT JOIN LATERAL ( SELECT json_agg(img.downloadurl ORDER BY img.downloadurl) AS image_urls FROM adempiere.m_productdownload img WHERE img.m_product_id = mpp.m_product_id ) imgs ON TRUE -- línea de estimado ligada al price (si existe) LEFT JOIN adempiere.sm_precio_estimadoline spel ON spel.sm_precio_estimadoline_id = mpp.sm_precio_estimadoline_id -- fallback: última línea de estimado aprobada para este producto LEFT JOIN LATERAL ( SELECT spel2.sm_precio_estimadoline_id AS id, spel2.pricestd, spel2.updated FROM adempiere.sm_precio_estimadoline spel2 JOIN adempiere.sm_precio_estimado spe2 ON spe2.sm_precio_estimado_id = spel2.sm_precio_estimado_id WHERE spel2.m_product_id = mpp.m_product_id AND spe2.docstatus = 'Y' ORDER BY spel2.sm_precio_estimadoline_id DESC LIMIT 1 ) est ON TRUE WHERE mplv.isweb = 'Y' ) SELECT COUNT(*) FROM base b WHERE b.m_product_id NOT IN (:exclu_0, :exclu_1, :exclu_2) AND LOWER(CONCAT_WS(' ', b.name, b.comercialname, b.sku, b.value)) LIKE :q AND b.marca_id = :marca_id AND (COALESCE(b.qty_function,0) - COALESCE(b.reserved_in_templates,0) + COALESCE(b.on_arrive,0)) > 0
Parameters:
[ "exclu_0" => 1001319 "exclu_1" => 1001101 "exclu_2" => 1001103 "q" => "%gphn1001637%" "marca_id" => 1000000 ] |
|
7.94 ms (7.62%) |
1 |
SELECT a0_.ad_user_id AS ad_user_id_0, a0_.ad_user_uu AS ad_user_uu_1, a0_.ad_client_id AS ad_client_id_2, a0_.isactive AS isactive_3, a0_.created AS created_4, a0_.createdby AS createdby_5, a0_.updated AS updated_6, a0_.updatedby AS updatedby_7, a0_.name AS name_8, a0_.description AS description_9, a0_.password AS password_10, a0_.email AS email_11, a0_.phone AS phone_12, a0_.birthday AS birthday_13, a0_.salt AS salt_14, a0_.islocked AS islocked_15, a0_.dateaccountlocked AS dateaccountlocked_16, a0_.failedlogincount AS failedlogincount_17, a0_.datepasswordchanged AS datepasswordchanged_18, a0_.datelastlogin AS datelastlogin_19, a0_.isexpired AS isexpired_20, a0_.securityquestion AS securityquestion_21, a0_.answer AS answer_22, a0_.c_bpartner_id AS c_bpartner_id_23, a0_.c_bpartner_location_id AS c_bpartner_location_id_24, a0_.c_activity_id AS c_activity_id_25, a0_.c_bpartner_id AS c_bpartner_id_26, a0_.c_bpartner_location_id AS c_bpartner_location_id_27, a0_.c_activity_id AS c_activity_id_28 FROM AD_User a0_ INNER JOIN c_bpartner c1_ ON a0_.c_bpartner_id = c1_.c_bpartner_id INNER JOIN AD_User_OrgAccess a2_ ON a0_.ad_user_id = a2_.ad_user_id WHERE a0_.isactive = 'Y' AND c1_.isactive = 'Y' AND c1_.issalesrep = 'Y' AND a0_.name LIKE ? AND a2_.ad_org_id = ? ORDER BY a0_.name ASC
Parameters:
[ "%%" 1000000 ] |
|
5.03 ms (4.82%) |
1 |
SELECT t0.ad_user_id AS ad_user_id_1, t0.ad_user_uu AS ad_user_uu_2, t0.ad_client_id AS ad_client_id_3, t0.isactive AS isactive_4, t0.created AS created_5, t0.createdby AS createdby_6, t0.updated AS updated_7, t0.updatedby AS updatedby_8, t0.name AS name_9, t0.description AS description_10, t0.password AS password_11, t0.email AS email_12, t0.phone AS phone_13, t0.birthday AS birthday_14, t0.salt AS salt_15, t0.islocked AS islocked_16, t0.dateaccountlocked AS dateaccountlocked_17, t0.failedlogincount AS failedlogincount_18, t0.datepasswordchanged AS datepasswordchanged_19, t0.datelastlogin AS datelastlogin_20, t0.isexpired AS isexpired_21, t0.securityquestion AS securityquestion_22, t0.answer AS answer_23, t0.c_bpartner_id AS c_bpartner_id_24, t0.c_bpartner_location_id AS c_bpartner_location_id_25, t0.c_activity_id AS c_activity_id_26, t0.c_bpartner_id AS c_bpartner_id_27, t0.c_bpartner_location_id AS c_bpartner_location_id_28, t0.c_activity_id AS c_activity_id_29 FROM AD_User t0 WHERE t0.ad_user_id = ?
Parameters:
[
1000089
]
|
order connection
| Time▼ | Count | Info |
|---|---|---|
|
8.41 ms (8.07%) |
1 |
SELECT COALESCE(SUM(lstl.qty), 0) AS reserved FROM sm_local_salestemplate lst JOIN sm_local_salestemplateline lstl ON lst.sm_salestemplate_id = lstl.sm_local_salestemplate_id WHERE lst.isactive = 'Y' AND lstl.m_product_id = :productId
Parameters:
[ "productId" => 1010516 ] |
Database Connections
| Name | Service |
|---|---|
| order | doctrine.dbal.order_connection |
| idempiere | doctrine.dbal.idempiere_connection |
Entity Managers
| Name | Service |
|---|---|
| order | doctrine.orm.order_entity_manager |
| idempiere | doctrine.orm.idempiere_entity_manager |
Second Level Cache
Second Level Cache is not enabled.
Entities Mapping
order entity manager
No loaded entities.
idempiere entity manager
| Class | Mapping errors |
|---|---|
| App\Entity\Idempiere\AdUser | No errors. |
| App\Entity\Idempiere\CBpartner |
|
| App\Entity\Idempiere\CBpartnerLocation | No errors. |
| App\Entity\Idempiere\CActivity | No errors. |
| App\Entity\Idempiere\AdUserRoles | No errors. |
| App\Entity\Idempiere\AdUserOrgaccess | No errors. |