Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TtMSP-0001WV-Ol for pgsql-performance@arkaria.postgresql.org; Thu, 10 Jan 2013 18:02:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TtMSO-0000UB-Ok for pgsql-performance@arkaria.postgresql.org; Thu, 10 Jan 2013 18:02:24 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TtMSN-0000U6-Vh for pgsql-performance@postgresql.org; Thu, 10 Jan 2013 18:02:24 +0000 Received: from hm1480-29.locaweb.com.br ([201.76.49.160]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TtMSM-0003iP-9g for pgsql-performance@postgresql.org; Thu, 10 Jan 2013 18:02:23 +0000 Received: from mcbain0005.email.locaweb.com.br (189.126.112.73) by hm1480-23.locaweb.com.br (PowerMTA(TM) v3.5r15) id hts12s0nva49 for ; Thu, 10 Jan 2013 16:02:20 -0200 (envelope-from ) Received: from bart0019.correio.biz (bart0019.correio.biz [200.234.210.21]) by mcbain0005.email.locaweb.com.br (Postfix) with ESMTP id 54B41440157 for ; Thu, 10 Jan 2013 16:02:20 -0200 (BRST) X-LocaWeb-COR: locaweb_2009_x-mail Received: from [192.168.9.1] (unknown [177.98.67.158]) (Authenticated sender: postgresql@vorio.com.br) by bart0019.correio.biz (Postfix) with ESMTPSA id 24EE0D858C for ; Thu, 10 Jan 2013 16:02:15 -0200 (BRST) Message-ID: <50EF0216.2050309@vorio.com.br> Date: Thu, 10 Jan 2013 16:01:58 -0200 From: PostgreSQL User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Updates on one row causing ExclusiveLock on PostgreSQL 8.3.5 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.3 at mcbain0005 X-Virus-Status: Clean X-CMAE-Score: 0 X-CMAE-Analysis: v=2.0 cv=aKdHX8Bm c=1 sm=1 a=cR/JT16FkKWA0YUOg3G8zQ==:17 a=jl2ymW9NZSsA:10 a=nsr0crgZWZoA:10 a=8nJEP1OIZ-IA:10 a=y6854WlnAAAA:8 a=oGg8BOWVxLsA:10 a=IhCsx3YMXc19sf6lPegA:9 a=wPNLvfGTeEIA:10 a=cR/JT16FkKWA0YUOg3G8zQ==:117 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org My best regards for all... Please. I need for an advice. I'm having a trouble, that puting others queries in wait state, becouse of ExclusiveLock granted by an Update that only update one row at each time. This update occurs into a function and this function are executed several times and concurrently. Below, query plan (explain): Nested Loop (cost=16.91..36.32 rows=1 width=75) -> HashAggregate (cost=16.91..16.92 rows=1 width=4) -> Index Scan using unq_customer_idx_msisdn on customer (cost=0.00..16.90 rows=1 width=4) Index Cond: ((msisdn)::text = '558796013980'::text) -> Index Scan using pk_customer_rel_channel on customer_rel_channel (cost=0.00..19.39 rows=1 width=75) Index Cond: ((customer_rel_channel.id_customer = customer.id_customer) AND (customer_rel_channel.id_channel = 282)) But, the pg_locs shows: PID Relation User Transaction Access Mode Granted Query Start Query 22569 customer_rel_channel postgres ExclusiveLock False 2013-01-10 15:54:09.308056-02 UPDATE news.customer_rel_channel SET status = $1, source = $2 WHERE news.customer_rel_channel.id_channel = $3 AND news.customer_rel_channel.id_customer IN (SELECT id_customer FROM public.customer WHERE public.customer.msisdn = $4) I can't understand what happens here... This query can't be lock granted becouse another instance of this query already granted it. I can't understand why an update that modify one row only need an ExclusiveLock. Thanks a lot!! -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance