I don't know if this is faster, but....Quote:}If I want to find the maximum value of a column I do
}SELECT MAX(x) etc.
}Right ? But it's slow of course and with an index on that column it's
}still slow, even when substituting the index name for the field name.
}How can one do find the max value in a fast efficient manner ?
At my previous job, we used version 5 of ingres. The way we did
a max that seemed to be faster was to retrieve into a simple field/variable
with a sort desc on it. I have not tried this is version 6, so I do not know
if it will still work. I am relatively new to SQL also, so forgive syntax
errors on the example below.
Select sim_field=col_to_max from table order by col_to_max desc;
When retrieving to a simple field or variable, it will retrieve the first
row only and ignore the rest of the rows. By changing the sort order you
can also get a min.