On 12 Oct 2011, at 2:31am, Shorty wrote:

> COLUMNS:
> grocery_type, description, price
> 
> ROWS:
> fruit, apple, 1.23
> fruit, banana, 5.35
> vegetable, carrot,  1.55
> vegetable, spinach, 6.85
> 
> -- HERE IS MY QUESTION: --
> Is faster for the sqlite database to have the grocery_type as a string or 
> integer?

Good question.  Integer.

> Or is the speed difference so small it doesn't matter?

By the time you're stocking a few thousand items, you should start seeing a 
difference.

> Like instead of having "fruit" in the grocery_type column, I could have it as 
> a "1" type, vegetables would be "2", and then translate that just before 
> spitting out the table to my web page.

Right.  You can even have another table called 'typecodes':

COLUMNS:
type_number,type_name

or something like that.  It's called 'normalisation'.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to