Subject OT?: Fastest tablelayout
Author Datatal AB - Gauffin, Jonas
Hello

Wich table design is the fastest of these two:

User_info
=========
Userid (PK)
First_name
Last_name
Password
MobileNo
MobileNo_Unformatted
ExtensionNo
ExtensionNo_Unformatted
AltNo
AltNo_Unformatted
MiniCall
MiniCall_Unformatted

Or:

User_info
=========
Userid (PK)
First_name
Last_name
Password

User_Number
===========
UserId (FK)
Number
Number_Unformatted
TypeId

Typeid specify the numbertype (mobile, extension, altnumber, minicall
etc etc)
The unformatted field is the number without any separators (formated
number can be +46-221-111 01 and the unformatted 4622111101), the
unformatted field is used when the user want to search after a number.

I got the second layout now with an index on number_unformatted

Typical search:
Select * from user_info ui, user_number un WHERE ui.userid=un.userid AND
number_unformatted like '46221%'

Thanks,
Jonas