I'm using MySQL with Django framework. (I have plan to change MySQL to PostgreSQL later)
Following is example case which abstracted real DB.
Column description
- ID(- int(11)type) : auto-incremented value from 1
- Column A(- int(10)type) : choice from 10 values
- Column B(- longtexttype): Text field
Example of data row
ID     |    Column A    |      Column B
               ...
21     |    301010101   |  TGGQtY84r033i0F6tpx3...
22     |    301010102   |  31TfNgzpxkcuMLxrrZ6D...
23     |    301010103   |  U069Z5kG354BwDriFw6d...
24     |    301010107   |  d4MSkCBxwZzKusALQAIQ...
25     |    301010105   |  R1SJCWeM62P1ikQwmG3f...
26     |    301010103   |  bVScBZbf0n1tkdgFCwmD...
27     |    301010102   |  4UpQGyCz5KhlolEdsO8M...
28     |    301010101   |  x89gOjNS4J4xiP1DfIWH...
29     |    301010110   |  STMlfUwx8afCZBsa8CWJ...
30     |    301010101   |  XctEBThnlA5MYTKqycLJ...
31     |    301010104   |  fRAEBMXDEdNFn5aENn4r...
31     |    301010105   |  GlIwVjVF16WE4zWnnSy8...
               ...
- Many rows (more than hundred thousands) 
- Each row have - Column Avalue among 10 values (301010101, .., 301010110)
Query usage
- Grouping by - Column Afirst, then ordering by- IDdescendingly.- For example, - Models.object.filter(Column A = "301010101").order_by('-id')
Question
For above case, what column would be the best for index ?
- IDas index (Default)
- Column Aas index
- Using - IDand- Column Atogether as index (Multi-index)
Edit : The result
I tested it with 500000 rows of random data. (with `ordering=['-id'] in Class Meta)
Then, I tested query Models.objects.filter(Column A = "301010101")
- IDas index (Default) : 0.33 sec
- Using - IDand- Column Atogether as index (Multi-index) : 0.12 sec
From the above test result, I convinced that using ID and Column A together as Multi-index is the most optimized case.
 
     
     
    