On 27 Aug 2015, at 3:06pm, Nicolas J?ger <jagernicolas at legtux.org> wrote:

>  so the only reason to define datatype in sqlite is for the size on
>  the disk ?

Nope.  It has no effect on the size on disk.

>  so why not just only using `BLOB` (excepted for `INTEGER PRIMARY
>  KEY`) ?
> 
>  being less persmissive wouldn't make querries run faster ?
>  for example, the comparisons would not have to try to attempt to
>  convert or even check and determine the type of the values.

SQLite does convert before the data is stored it if finds that it can do so 
without losing accuracy.

So you can declare a column as INTEGER and supply the string '1234' and it will 
be converted to the number 1234 before it is stored.  You can check this out 
using

SELECT x,typeof(x) FROM myTable

This means that the conversion is done once on storage rather than each time on 
retrieval, just as you would want for speed.  If just means that if you try to 
supply the string 'NaN' or 'infinity' for the next row SQLite will still store 
it rather than generating an error message.

Simon.

Reply via email to