mysql statement with inner SELECT - how to improve performance
        Posted  
        
            by ernie
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ernie
        
        
        
        Published on 2010-04-22T10:53:31Z
        Indexed on 
            2010/04/22
            11:03 UTC
        
        
        Read the original article
        Hit count: 337
        
This statement appears inefficient because only one one out of 10 records are selected and only a of 100 entries contain comments.
What can I do to improve it ?
$query = "SELECT 
A,B,C,  
(SELECT COUNT(*)
    FROM comments
    WHERE comments.nid = header_file.nid) 
    as my_comment_count
FROM  header_file
Where A = 'admin' "
© Stack Overflow or respective owner