On 9/11/15 4:50 AM, Sridhar N Bamandlapally wrote:
1) creating temporary table (say temp_users) on table users with required data/columns-list and index on column user_id, ...this will be faster as there will be no joins with other tables 2) also need index on table auths_with_trans column user_id 3) replacing users with temp_users in BEGIN block
That's not really going to help unless the slow part is that you're using a cursor (which is why I don't like them...)
FWIW, now that there's better transactional visibility support in the catalogs it might be possible to reduce the lock contention of trunkcate.
-- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general