"Ian Cass" <ian.cass@mblox.com> writes:
> I'm transferring a database & reporting scripts across from Oracle & a few
> of the SQL statements behave a little differently with regards to indexes.
> The one that's got me stumped at the moment is this...
> select * from messages, statusinds
> WHERE statusinds.gateway_id = messages.gateway_id
> AND (messages.client_id = '7' AND messages.user_name in ('U66515'))
> limit 5;
> (tables_YYYYMM are inherited)
There's your problem (and don't tell me Oracle gets this right; they
don't do inheritance, do they?). The planner isn't smart about
indexscan-based joins for inheritance trees. This could possibly be
improved with some work, but I haven't thought about the details.
regards, tom lane