Thanks, that reduces the difference in times to ~30ms. I was not expecting the lack of typing to have such a bad effect. I MUST remember to always declare types from now on :-)
I agree it's not really obvious that typed variables are so much faster; indeed there are still some cases in which you might get slightly better performance with untyped values. In future, queries such as yours will be optimized at runtime (by generating more than one execution plan and choosing the cheapest at runtime) , but that's still on our todo list..
Your questions are welcome, Christian