Re: avoid lock conflict between SELECT and TRUNCATE - Mailing list pgsql-general

From Jim Nasby
Subject Re: avoid lock conflict between SELECT and TRUNCATE
Date
Msg-id 55F7C2E5.1060304@BlueTreble.com
Whole thread Raw
In response to Re: avoid lock conflict between SELECT and TRUNCATE  (Sridhar N Bamandlapally <sridhar.bn1@gmail.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: Ben Chobot
Date:
Subject: pgpass (in)flexibility
Next
From: Johann Spies
Date:
Subject: Materialized View or table?