when testing my sql to understand how an index of H2 works, i find
some unnecessary loop . The sql likes that :

SELECT * FROM TEST WHERE AGE > 0

if the most row's value on the column AGE is bigger than 0, H2 still
search and check them. the related code (see the file Select.java,
method queryFlat() ) :

512    while (topTableFilter.next()) {
513    setCurrentRowNumber(rowNumber + 1);
514    if (condition == null ||
Boolean.TRUE.equals(condition.getBooleanValue(session))) {

before the code , i still find condtion optimize in method prepare() :

796    if (condition != null) {
797    condition = condition.optimize(session);

but no optimization occurs in this place,

i think the condition expression could optimize like : AGE >=1 , to
avoid unnecessary loop in method queryFlat().

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to