Re: [sqlite] dates and optimizations

2012-12-07 Thread Igor Tandetnik
On 12/7/2012 11:35 AM, Simon Slavin wrote: most of my systems store dates as strings in this format "MMDD". Better still (IMHO), integers in the format MMDD (e.g. 20121207). Integers are stored a bit more compactly by SQLite, and are compared slightly faster. And you can still

Re: [sqlite] dates and optimizations

2012-12-07 Thread Paxdo Presse
> > > But do you really do things like run a search on "invoices made ​​on a Monday > in February" ? Yes. For example, in a store, it is useful to have sales statistics by day of the week, or by time slot, etc.. > Most of the time I store a date I'm storing it for three purposes: > > A)

Re: [sqlite] dates and optimizations

2012-12-07 Thread Simon Slavin
On 7 Dec 2012, at 4:24pm, Paxdo Presse wrote: > select invoice.date from invoice where strftime('%m', invoice.date)='02' and > strftime('%w', invoice.date)='1' > > For invoices made ​​on a Monday in February. > From your experience, these requests are they fast? 'fast' is the

[sqlite] dates and optimizations

2012-12-07 Thread Paxdo Presse
Hello, To search and sort the dates in SQLite, the SQL methods (strftime and date) are they fast enough on long dates (as '2012-12-07 01:48:45')? Or would you prefer to store separately the day, year, etc..? example: select invoice.date from invoice where strftime('%m', invoice.date)='02'