> On 19 Nov 2015, at 2:49pm, Andrew Stewart <AStewart at arguscontrols.com>
> wrote:
>
> Had a question regarding what I am trying to do. One thing that I have
> noticed is that it is slow to do this. I do not have any indexes created and
> there is no primary index on this table.
I bet whatever you're doing, a well-chosen index will speed it up.
> I am using a 'DateTime' variable for the date/time. I understand this
> translates to a Numeric.
Correct.
> It appears to be getting handled as a string, but not sure.
SQLite has column affinity rather than column type. So it will let you put a
string into a Numeric column if that's what you tell it to do. It will
definitely not translate a string that doesn't look like a number (e.g. has
"May" in it) into a number without you telling it to.
> Would it be any better if I stored the date/time as a Integer (64bit value).
> This would be using the C routine for generating a date/time based upon the
> __time64 type (number of seconds since jan 1 1970 0:0:0).
It will definitely be faster processing integers than processing strings.
You could even use a function built into SQLite to do it:
SELECT strftime('%s','2004-01-01 02:34:56');
INSERT INTO myTable (timeStamp) VALUES (strftime('%s','2004-01-01 02:34:56'));
For information on date & time formats accepted, see
<https://www.sqlite.org/lang_datefunc.html>
Simon.