Tom Deblauwe wrote:
Hello,
[snip]speed problem[/snip] For the purpose of testing the existance of a record, it seems that using this statement: select date from mytable where yearmonth = 200508 and date = 1 limit 1; is slower than this: select 1 from mytable where yearmonth = 200508 and date = 1 limit 1; This is because no lookup for the column 'date' in the main table is done in the second case, which reduced the query from 2.6 seconds to 0.95 On a sidenote: maybe this can be put in the documentation, optimizing queries? Also maybe something to put there: queries go a LOT faster when not sorting using 'order by'. Maybe this is obvious, but it wouldn't hurt to put it on that page, because I hadn't thought of it at first. Thanks for your time, kind regards, Tom,