Skip to content

Instantly share code, notes, and snippets.

/query.sql Secret
Created Oct 30, 2016

Embed
What would you like to do?
DESC
SELECT
name
FROM
accounts
WHERE
del_flg = 0
AND creation_time < '2016/10/29 00:00'
AND RAND() < (SELECT (CAST(10 AS DOUBLE) / COUNT(id) * 10) FROM accounts WHERE del_flg = 0 AND creation_time < '2016/10/29 00:00')
LIMIT
10
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY accounts range del_flg,creation_time,creation_time_del_flg_name creation_time_del_flg_name 4 \N 1561090 Using where; Using index
2 SUBQUERY accounts range del_flg,creation_time,creation_time_del_flg_name creation_time_del_flg_name 4 \N 1561090 Using where; Using index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.