Jump to content

Faster queries?


samoht

Recommended Posts

Hello All,

 

I am noticing that some of my pages are taking a few seconds to load, and I have a hunch my queries could be written better to speed things up.

 

One of my problems is that I have a ton of tables for many of my simple queries -

here is an example:

SELECT i.Name AS ItemName, pd.ItemId as Id, pd.ProductId, pd.Name, pd.PriceRetail, pp.PriceSell, i.ImagetnURL, QtyInStock, pack.PackageType, s.Name as Size 
FROM product pd, item i, productprice pp, itemfeatures itf, features f, packaging pack, size s, brands b
WHERE f.Name = '$pageTitle'
			AND pd.PackageId = pack.PackageId
			AND itf.FeatureId = f.FeatureId
			AND itf.ItemId = i.ItemId
			AND i.BrandId = b.BrandId
			AND pd.SizeId = s.SizeId
			AND pd.ItemId = i.ItemId
			AND pd.ProductId = pp.ProductId
			AND ClientPriceCode = 'R1'
ORDER BY pd.Name";

 

Do the multiple "AND" declarations slow things down??

 

what is a better/ faster way?

 

Thanks for the help,

Link to comment
Share on other sites

the mysql page says;

 

"INNER JOIN and ,  (comma) are semantically equivalent in the absence of a join condition: both produce a Cartesian product between the specified tables (that is, each and every row in the first table is joined to each and every row in the second table)."

 

So does that mean that I was using INNER JOINS and didn't know it??

 

 

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.