Brett McCormick wrote:
>
> sas=> explain update user set usrid = 'aaaaaaaa'
> where usrseqid=usrseqid('zlb');
>
> NOTICE: QUERY PLAN:
>
> Seq Scan on user (cost=344.07 size=658 width=154)
...
> as you can see, it uses the index when the RHS of the comparison
> in the where clause is a subquery, but a sequential scan when it
> isn't. is this a bug?
Yes, and very old :)
This is from my recent posting:
---
Another issue - handling of functions with constant args
in queries - for query
select * from T where A = upper ('bbb')
function upper ('bbb') will be executed for each tuple in T!
More of that - if there is index on T(A) then this index will
not be used for this query!
Obviously, upper ('bbb') should be executed (by Executor, not
parser/planner) once: new Param type (PARAM_EXEC) implemented
for subselects could help here too...
---
Actually, this is easy to fix...
Vadim