Just taking a shot, as I have seen in some previous issues? Ignore is notrelevant.
Can you run vacuum on pg_class and check the query again , or do you seepg_class bloated ?
The other option would be gdb backtrace I think that would help.