Re: how to show 6 randomly selected featured products?

From: Date: Thu, 09 Feb 2006 02:06:24 +0000
Subject: Re: how to show 6 randomly selected featured products?
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-230136@lists.php.net to get a copy of this message
Can you post it how it comes back or copy/paste it to a webpage (.txt is fine) so we can see it formatted? Afan Pasalic wrote:
Hm. Have no idea what does it means: table type possible_keys key key_len ref rows Extra p ALL NULL NULL
     NULL
NULL
     1268
Using where; Using temporary; Using filesort chp index NULL PRIMARY
        8
NULL
     1741
Using index c eq_ref PRIMARY PRIMARY
        4
chp.cat_id
        1
 pr
ALL NULL NULL
     NULL
NULL
    10231
 
-afan On Thu, 2006-02-09 at 09:53 +1100, Chris wrote:
Hi, Grab that query and run it through mysql with 'explain', so: explain SELECT p.prod_id, p.prod_name, p.prod_no, chp.cat_id, c.cat_name, c.cat_parent, pr.price FROM products as p LEFT JOIN categories_has_products as chp ON chp.prod_id = p.prod_id LEFT JOIN categories as c ON chp.cat_id = c.cat_id LEFT JOIN prices as pr ON pr.prod_id = p.prod_id WHERE prod_featured = '1' ORDER BY RAND(), pr.price ASC LIMIT 6 That will show you whether you are using the database indexes or not. If you can't work it out then post the explain output.


« previous php.general (#230136) next »