diff --git a/docs/2022-07-31-sql.html b/docs/2022-07-31-sql.html index 7e00638..5af1d04 100644 --- a/docs/2022-07-31-sql.html +++ b/docs/2022-07-31-sql.html @@ -205,17 +205,17 @@
CREATE INDEX idx_user_id_created_at ON user_upload (user_id, created_at); --- Do not +-- Bad SELECT * FROM user_upload ORDER BY user_id, created_at DESC; --- Do +-- Good SELECT * FROM user_upload ORDER BY user_id DESC, created_at DESC; --- Or do +-- Also good SELECT * FROM user_upload ORDER BY user_id, created_at;@@ -390,6 +390,27 @@ database reality :) + +
+ Show index of table: +
+SELECT DISTINCT
+ table_name,
+ index_name
+FROM information_schema.statistics;
+ Memory