SELECT, p.thread_id, p.user_id, p.pubdate, p.editdate, p.edittimes, p.rating, p.attach_count, p.content_html, p.pinned,
                       u.nickname, u.login, u.is_deleted, u.logdate, u.status,
                       up.imageurl, up.signature_html,, up.karma, g.access as group_access, g.is_admin 
                FROM gp_forum_posts p
                LEFT JOIN gp_users u ON = p.user_id
                LEFT JOIN gp_user_profiles up ON up.user_id =
                LEFT JOIN gp_user_groups g ON u.group_id =
                WHERE 1=1
                 AND (p.thread_id = '49596')

                ORDER BY p.pinned DESC, p.pubdate ASC 
LIMIT 0, 20
The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay