By "last patch" you mean http://archives.postgresql.org/pgsql-committers/2007-10/msg00409.php?
Sorry for confusion, I meant this one: http://archives.postgresql.org/pgsql-bugs/2007-10/msg00217.php Is it the same as the commited one?
If so that's about as fast as it's likely to get. 22 tables is well beyond what I'd consider reasonable to run through the exhaustive planner. You should try geqo again.
OK, no problem... Anyway, many thanks for the quick patches! Kuba