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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.