Created
December 6, 2011 07:01
-
-
Save Kimtaro/1437129 to your computer and use it in GitHub Desktop.
Some helpful SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM table PROCEDURE ANALYSE(0,0)\G | |
-- "ANALYSE() examines the result from a query and returns an analysis of the results that suggests optimal data types for each column that may help reduce table sizes." | |
SELECT COUNT(DISTINCT(SUBSTR(column, 1, 22))) / COUNT(DISTINCT(column)) * 100 FROM table; | |
-- Figures out index coverage with the given index length (22 here). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment