Would it be possible to catch an unconstrained max(id)/min(id) and rewrite 
it as "select id from table order by id [desc] limit1" on the fly in the 
parser somewhere?

That would require fairly little code, and be transparent to the user.  
I.e. low hanging fruit.

On 5 Sep 2003, Greg Stark wrote:

> Note that that only handles min()/max() for the whole table. It doesn't handle
> the GROUP BY case, for that you need DISTINCT ON with an ORDER BY clause.


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to