Jump to content

Query Speed


Canman2005

Recommended Posts

Hi all

 

I have the following QUERY

 

SELECT cart_log.type,cart_log.product_id, cart_log.title, cart_log.prod_quantity_in_packet FROM orders, cart_log, products_supplier_information WHERE ((orders.orders_status = 1) || (orders.orders_status = 2) || (orders.orders_status = 3)) AND cart_log.unique_id = orders.order_unique_id AND products_supplier_information.product_id = cart_log.product_id AND products_supplier_information.supplier_id = 1 GROUP BY cart_log.product_id

 

but it seems to be taking ages to run, sometimes up to half an hour and sometimes it busts the browser and you have to re-start.

 

can anyone suggest anythign which could speed it up?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/134340-query-speed/
Share on other sites

How much data is in the table? What's your server like?

 

This won't make much difference to the query speed at all but to help you with future queries:

 

((orders.orders_status = 1) || (orders.orders_status = 2) || (orders.orders_status = 3))

 

Can be condensed into:

 

orders.orders_status IN (1, 2, 3)

 

Adam

Link to comment
https://forums.phpfreaks.com/topic/134340-query-speed/#findComment-699385
Share on other sites


SELECT cart_log.type,cart_log.product_id, cart_log.title, cart_log.prod_quantity_in_packet FROM orders, cart_log, products_supplier_information WHERE orders.orders_status IN (1, 2, 3) AND cart_log.unique_id = orders.order_unique_id AND products_supplier_information.product_id = cart_log.product_id AND products_supplier_information.supplier_id = 1 GROUP BY cart_log.product_id

 

Is the best I could come up with, I'm thinking there must be a problem with the config on the DB server because this is not a "bad" query so much as it is an exact query, what DBMS are you using?

Link to comment
https://forums.phpfreaks.com/topic/134340-query-speed/#findComment-699402
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.