database - Does the foreign key in sqlite store the whole value, or just the pointer to the actual value in other table? -


i have table thousands of records, each of them have field "region", can have 1 of 6 values - "north america", "south america", "asia", etc. size of db decrease if create separate table "regions" , point original db's region field new table foreign key?

your region strings stored 1 byte per character, while small numbers can stored in single byte. database size indeed decrease.

(the theoretical number of saved bytes determined select sum(length(region) - 1) mytable, dividing of pages records, , additional page needed store regions table, reduce that.)


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -