mysql - Will I see performance gains by creating table relationships? -
i understand benefits of using table relationships in order create constraints, such preventing row being deleted 1 table when related row in another.
but doing improve performance when running joined queries.
eg. suppose have innodb tables user , userinfo shown below:
user |field |type |null |key |default |extra --|id |int(11) |no |pri | |auto_increment | |email |varchar(700)|no | | | | |password|varchar(255)|no | | | | |active |varchar(1) |no | |n | | |created |timestamp |no | |current_timestamp| | | userinfo | |field |type |null |key |default |extra --|user |int(11) |no |pri | | |name |varchar(100)|no | | | |position|varchar(100)|no | | | ...
is beneficial in terms of performance when running following query?
select * user u join userinfo ui on u.id = ui.user
it's index might (and will) boost performance, not foreign key alone.
also: mysql creates foreign key indexes automatically innodb.
Comments
Post a Comment