Skip to content

Instantly share code, notes, and snippets.

/query.sql Secret

Created October 30, 2016 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d7a5b438f534dc3d698692316877bdb0 to your computer and use it in GitHub Desktop.
Save anonymous/d7a5b438f534dc3d698692316877bdb0 to your computer and use it in GitHub Desktop.
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