SELECT count_given as rating_count, rating, 1 as given
FROM dark_postrating_count
WHERE user_id = ?
UNION
SELECT count_received as rating_count, rating, 0 as given
FROM dark_postrating_count
WHERE user_id = ?
ORDER BY rating_count desc, rating asc

Params: 1980, 1980

Run Time: 0.000361

Select Type

Table

Type

Possible Keys

Key

Key Len

Ref

Rows

Extra

PRIMARY

dark_postrating_count

ref

user_id_rating

user_id_rating

4

const

6

UNION

dark_postrating_count

ref

user_id_rating

user_id_rating

4

const

6

UNION RESULT

<union1,2>

ALL

Using filesort

SELECT COUNT(*)
FROM xf_liked_content
WHERE like_user_id = ?

Params: 1980

Run Time: 0.010630

Select Type

Table

Type

Possible Keys

Key

Key Len

Ref

Rows

Extra

SIMPLE

xf_liked_content

ref

like_user_content_type_id

like_user_content_type_id

4

const

810

Using index

SELECT count_given as rating_count, rating, 1 as given
FROM dark_postrating_count
WHERE user_id = ?
UNION
SELECT count_received as rating_count, rating, 0 as given
FROM dark_postrating_count
WHERE user_id = ?
ORDER BY rating_count desc, rating asc

Params: 1980, 1980

Run Time: 0.000367

Select Type

Table

Type

Possible Keys

Key

Key Len

Ref

Rows

Extra

PRIMARY

dark_postrating_count

ref

user_id_rating

user_id_rating

4

const

6

UNION

dark_postrating_count

ref

user_id_rating

user_id_rating

4

const

6

UNION RESULT

<union1,2>

ALL

Using filesort

SELECT COUNT(*)
FROM xf_liked_content
WHERE like_user_id = ?

Params: 1980

Run Time: 0.000482

Select Type

Table

Type

Possible Keys

Key

Key Len

Ref

Rows

Extra

SIMPLE

xf_liked_content

ref

like_user_content_type_id

like_user_content_type_id

4

const

810

Using index

SELECT count_given as rating_count, rating, 1 as given
FROM dark_postrating_count
WHERE user_id = ?
UNION
SELECT count_received as rating_count, rating, 0 as given
FROM dark_postrating_count
WHERE user_id = ?
ORDER BY rating_count desc, rating asc

Params: 1980, 1980

Run Time: 0.000355

Select Type

Table

Type

Possible Keys

Key

Key Len

Ref

Rows

Extra

PRIMARY

dark_postrating_count

ref

user_id_rating

user_id_rating

4

const

6

UNION

dark_postrating_count

ref

user_id_rating

user_id_rating

4

const

6

UNION RESULT

<union1,2>

ALL

Using filesort

SELECT COUNT(*)
FROM xf_liked_content
WHERE like_user_id = ?

Params: 1980

Run Time: 0.000566

Select Type

Table

Type

Possible Keys

Key

Key Len

Ref

Rows

Extra

SIMPLE

xf_liked_content

ref

like_user_content_type_id

like_user_content_type_id

4

const

810

Using index

SELECT title, template_compiled
FROM xf_template_compiled
WHERE title IN ('PatsFans_2014_Header')
AND style_id = ?
AND language_id = ?