Skip to content

Instantly share code, notes, and snippets.

@begin29
Created December 23, 2016 16:57
Show Gist options
  • Save begin29/4c8d1672872bf87ad7a6d7840d1b479a to your computer and use it in GitHub Desktop.
Save begin29/4c8d1672872bf87ad7a6d7840d1b479a to your computer and use it in GitHub Desktop.
indexes, when should add index
# show indexes
show INDEXES from table_name
when I should add index?
#when selectivity is big
selectivity = count of variations/all rows * 100%
#selectivity for sex column is low: sel_of_sex = 2(male, female)/10000 *100 = 0.02%
#http://www.programmerinterview.com/index.php/database-sql/selectivity-in-sql-databases/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment