SQLite Forum

Numeric vs integer
Login
I imported a database from another RDBMS, which has many columns defined as "i2".  SQLite3 doesn't recognise this as "int2" so the column was created with affinity of Numeric and type as NUM. The loaded data is all integers, so a typeof() returns integer. 

I find however that I frequently seem to need to cast these columns as integer in order for maths to work correctly.

Question 1: How much space is taken up in the physical database by a NUM/Numeric field which is storing the integer value 3? If converted to Integer it will be 8 bytes - if the current definition is also 8 bytes then the space requirements will not change. 

Question 2: Am I correct to assume that a value defined as integer will be more efficient in artihmetic functions (eg, sum(..)) than having the integer value stored in a Numeric field? Although I would expect it to be very marginal...