On 14.7.2014 00:55, Magers, James wrote: > I am using a Pentaho process to access the database and select the > appropriate information to update the DB tables and records. I am > trying to select the previous subscription key in order to update the > factable for any records that have the previous key to have the current > subscription key. This query is intended to use the current subscription > key and subscription info to select the previous subscription key to > allow for the information to be updated. I would like to optimize the > query to execute more efficiently. > > The database table has about 60K records in it and when I run an explain > anaylyze it indicates that the query optimizer chooses to execute a > bitmap heap scan, this seems like an inefficient method for this query. Why do you think it's inefficient? The planner thinks it's efficient, for some reason. And it's impossible to say if that's a good decision, because we don't know (a) the explain plan, and (b) structure of the table involved (indexes, ...). Please post the explain analyze output to explain.depesz.com and post the link here (it's more readable than posting it here directly). Also, please do this: SELECT relname, relpages, reltuples FROM pg_class WHERE relname = 'member_subscription_d' and this \d member_subscription_d and post the results here. regards Tomas