You are here: Re: Optimizing an SQL statment « All PHP « IT news, forums, messages
Re: Optimizing an SQL statment

Posted by Stefan Rybacki on 10/31/05 22:01

jj wrote:
> Hi !
>
> I have a query that i run on my website, heres the pseudo code:
>
> select
>
> bottle_caps.caps_id,
>
> products.products_id,
> products.products_name,
> products.products_image,
> products.products_image_hi,
> products.products_status,
>
> price.price_option,
> price.price
>
> from
>
> bottle_caps, products, price
>
> where
>
> products.products_model = price.products_id
> AND
> price.products_id = bottle_caps.caps_id
> AND
> bottle_caps.bottle_id = $sub_products_id
>
>
> It works fine except for the fact that it takes about 3 seconds to execute.
> So there is a little bit of a hiccup on my site when this code is loaded.
> Im wondering is there something I could do to this SQL statement to make it
> execute faster?
> (the 3 tables are all about 2-4 thousand rows each)

Are there indices on the ids? What does Explain tell you?

Regards
Stefan

>
> THanks!
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация