Hi Simon,

Thanks for this. Removing the date() around Appointment_StartDate, and the 
trim() from around the ?, makes no difference. All results are similar - slow, 
till I drop and recreate the index (ie then fast); then becoming slow again 
when I run the ANALYZE command. 

Best wishes,

Hamish

>> LEFT JOIN Appointment ON Appointment_TxnUUID=Txn_UUID 
>>              WHERE ( date( Appointment_StartDate ) >= trim( ? ) AND date( 
>> Appointment_StartDate ) <= trim( ? ) ) )
> 
> The application of a function to the column values means that it is not 
> possible for the optimiser to penetrate this WHERE clause and work out a good 
> strategy.  Try to change this to
> WHERE Appointment_StartDate BETWEEN ? AND ?
> by converting the parameters you bind in to text, rather than by asking 
> SQLite to convert every value in the column to a date.
> 
> This isn't the only thing that's causing a problem, but it might be the 
> easiest to fix.
> 
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

--
Hamish Symington
07815 081282  :  info at hamishsymington.com

I also set custom cryptic crosswords: www.customcrypticcrosswords.com 
(@CustomCryptics on Twitter)

Reply via email to