Whenever you are considering creation of multicolumn index, there is a question what should be the order of columns in this index. I'll try to analyze various cases of this situation.
Every now and then there is someone on IRC, mailing lists, or private contact which asks about rules.
My answer virtually always is: don't use rules. If you think that they solve your problem, think again. Why?
couple of times is was brought to attention of #postgresql channel – how to find longest prefix.
case: you have phone number, and you want to find which carrier it is bound to.
there are at least 3 ways of finding it, and i decided to take a look at which is fastest.