Re: [SQL] Using a compound primary key

2003-07-27 Thread Tom Lane
"David Witham" <[EMAIL PROTECTED]> writes: > select * from tariff > where tariff_type = 'UIA' > and prefix in ('44','441','4412','44123','441234','4412345','44123456') > order by prefix desc limit 1; > The query doesn't use the primary key index as I might expect: Flip the index column order ---

[SQL] Using a compound primary key

2003-07-27 Thread David Witham
Hi all, I have a table containing tariff information. It has a primary key (and therefore unique index) of (tariff_type varchar(5),prefix varchar(12)) where tariff_type is a set of rates assigned to dialling prefixes. e.g. tariff_type prefix rate abc 44 $x abc 4