HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Foreign key constraints with MySQL/InnoDB

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
constraintswithinnodbforeignmysqlkey

Problem

I am try to do some performance testing with varchar foreign keys vs int foreign keys and was wondering how foreign key constraints effect performance of MySQL.

I assume that they effect inserted/updates to a degree however I am not to worried about that in my testing. I was wondering if they effect SELECT statements and if they effect data/index size?

Solution

"integers are cheaper to compare than characters, because character sets and collations (sorting rules) make character comparisons complicated. Integers are very good when using as an index column." - HottestGuide

Context

StackExchange Database Administrators Q#15918, answer score: 2

Revisions (0)

No revisions yet.