SELECT resource.*
,
version.version_string,
version.release_date,
version.download_url,
version.rating_count AS version_rating_count,
version.rating_sum AS version_rating_sum,
version.download_count AS version_download_count,
user.*, user_profile.*, IF(user.username IS NULL, resource.username, user.username) AS username,
attachment.attachment_id,
attachment.view_count AS attachment_view_count,
attachment_data.filename AS attachment_filename,
attachment_data.file_size AS attachment_file_size,
feature.feature_date,
0 AS is_watched,
0 AS last_download_date
FROM xf_resource AS resource
LEFT JOIN xf_resource_version AS version ON
(version.resource_version_id = resource.current_version_id)
LEFT JOIN xf_user AS user ON
(user.user_id = resource.user_id)
LEFT JOIN xf_user_profile AS user_profile ON
(user_profile.user_id = resource.user_id)
LEFT JOIN xf_attachment AS attachment ON
(attachment.content_type = 'resource_version' AND attachment.content_id = version.resource_version_id)
LEFT JOIN xf_attachment_data AS attachment_data ON
(attachment_data.data_id = attachment.data_id)
LEFT JOIN xf_resource_feature AS feature ON
(feature.resource_id = resource.resource_id)
WHERE resource.resource_id = ?
Params: 312
Run Time: 0.000365
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|
SIMPLE | resource | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SIMPLE | version | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SIMPLE | user | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SIMPLE | user_profile | const | PRIMARY | PRIMARY | 4 | const | 1 | |
SIMPLE | attachment | ref | content_type_id_date | content_type_id_date | 31 | const,const | 1 | Using where |
SIMPLE | attachment_data | eq_ref | PRIMARY | PRIMARY | 4 | psychopa_vanilla.attachment.data_id | 1 | Using where |
SIMPLE | feature | eq_ref | PRIMARY | PRIMARY | 4 | const | 1 | |