sql - What's the database performance improvement from storing as numbers rather than text? -


suppose have text such "win", "lose", "incomplete", "forfeit" etc. can directly store text in database. instead if use numbers such 0 = win, 1 = lose etc material improvement in database performance? on queries field part of clause

at cpu level, comparing 2 fixed-size integers takes 1 instruction, whereas comparing variable-length strings involves looping through each character. large dataset there should significant performance gain using integers.

moreover, fixed-size integer take less space , can allow database engine perform faster algorithms based on random seeking.

most database systems have enum type meant cases yours - in query can compare field value against fixed set of literals while internally stored integer.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -