Ralph Mason <[EMAIL PROTECTED]> writes:
> I have a simple query that is running inside a plpgsql function.

> SELECT INTO _point_id id FROM ot2.point WHERE unit_id = _unit_id AND 
> time > _last_status ORDER BY time LIMIT 1;

It would probably help significantly to make that be
"ORDER BY unit_id, time".  This'd eliminate the need for the separate
sort step and encourage the planner to use the index, even when it does
not know whether the "time > x" condition is selective or not.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to