| Article: |
Emulating Analytic (AKA Ranking) Functions with MySQL | |
| Subject: | Great article! | |
| Date: | 2007-04-01 01:05:59 | |
| From: | fauigerzigerk | |
| That's very useful. I just wonder why the rank query took 26 seconds after you added the index. Even if every single person had a different salary, which is unlikely for a real payroll, there would be no more than 10000 entries in that index. That means we need 13 steps to find an entry (in a btree) and then at most 4 traversal steps in the tree to find the rank. So we're talking about a mere 170,000 steps which should definately result in a a sub-second runtime. I suspect the optimizer doesn't use the where criteria to cut short the tree traversal. | ||
Women in Technology
Hear us Roar
