Reputation: 65
Let's say I have a spinner with 4 options from which the user can choose:
I'll need to store that option in the table in SQLite database. I can assign to those options either values 0, 1, 2, 3 or letters a, b, c, d.
The question is, in terms of space, is it better to create a column with datatype INTEGER and store numbers in it? Does it make a big difference if I define the column as TEXT and store one character values in it?
EDIT: I'm planning to upload the data from this SQLite database stored on Android device to PostgreSQL database located on a server and the corresponding column there is of a Char(1) datatype. Should I change the type of that one too or will it be easy to somehow make a conversion between let's say 2 and 'c' when inserting new rows to PostgreSQL table based on the rows from SQLite table?
Upvotes: 2
Views: 58
Reputation: 180080
In the SQLite file format, the values 0
and 1
need one byte less than 2
, 3
, 'a'
, ..., 'd'
.
However, on a mobile device, you will never have enough data that the difference would matter. Use whatever is easiest to handle.
Upvotes: 1