*** 221,225 **** --- 221,243 ---- it in yourself rather than letting the optimizer do it for you.</p> + <H2>A SELECT which only accesses the index of a table, not the table row data</H2> + + <p>Checked only with version 2.8.18! When you only want to check if something exists in a table which has an index(e.g. an index on "hour"), you might do this like so:</p> + + <pre> + SELECT hour FROM appointments WHERE hour=5 LIMIT 1; + - or worse - + SELECT * FROM appointments WHERE hour=5 LIMIT 1; + </pre> + + But both first check the index and then get the value of "hour" from the table row, not from the index itself. So what is quicker is simply this: + + <pre> + SELECT 1 FROM appointments WHERE hour=5 LIMIT 1; + </pre> + + Now SQlite doesn't have to read the value and just puts the number 1 in the result row so you know there are appointments at 5. + This is mostly usable when you for example give an overview of a day and have to indicate on what hours there are appointments. Personally I used this on a not so powerful embedded system, so it be not so noticable on a PC platform of course. </html>