Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 086BA1CF17EC for ; Tue, 13 Mar 2012 02:43:23 -0300 (ADT) Received: from mail-pz0-f46.google.com ([209.85.210.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S7KW2-00017v-Hd for pgsql-performance@postgresql.org; Tue, 13 Mar 2012 05:43:23 +0000 Received: by dajr28 with SMTP id r28so323108daj.19 for ; Mon, 12 Mar 2012 22:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=F6mWHchw5aKa32CNfu8aZjWX9uNtzanl7LSwhYgowWY=; b=c7IaSgX3YMzrHoxUrfklEQFCeHCKj1xebHXFV+64OM4v0z7Pt/+ApCknBdDVhr5xW2 QIVEgmWRnIZFV5ugbBhj2iyyAoIikiBed0WLIYorzeb8Z2LZ0Igq5FwldqgJ9HIrUD9G yWNgDgVSB1IcNw9qcjZNva/GQCp23wP+T471wYDJ1TqVUK72VIJdanfFxG990hcDuSx9 U17dHK9Wp0PhNbcR7p94Fd1UHJsU1FkkMf0QNanDi9P9uPDYuA56vLtyLIy9bL0l1Ho3 Yc7sj6msZ87bT+sb+Y8eD9ei270RUDQeNsuvgEpcBCOR+5vfiO/hYPppm4X6eQNHaUc0 thnA== Received: by 10.68.125.195 with SMTP id ms3mr4546157pbb.62.1331617389759; Mon, 12 Mar 2012 22:43:09 -0700 (PDT) Received: from [192.168.1.46] ([116.226.41.123]) by mx.google.com with ESMTPS id d6sm200171pbi.23.2012.03.12.22.43.07 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Mar 2012 22:43:08 -0700 (PDT) Message-ID: <4F5EDE67.3040908@gmail.com> Date: Tue, 13 Mar 2012 13:43:03 +0800 From: Rural Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Gin index insert performance issue Content-Type: text/plain; charset=GB18030; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.5 (-) X-Archive-Number: 201203/102 X-Sequence-Number: 46552 I'm using gin index for my full text search engine in production. These days the gin index size grows to 20-30G and the system started to suffer with periodical insert hanging. This is same as described in the 2 posts: http://postgresql.1045698.n5.nabble.com/Random-penalties-on-GIN-index-updates-td2073848.html http://postgresql.1045698.n5.nabble.com/Periodically-slow-inserts-td3230434.html The gin index is on a dedicated raid 10 SAS disk and the performance should be enough for normal db operation. But I always see almost 100% disk utiliztion on the disk when the inserts hang. The utiliztion for other data(such as the full text table data) on another disk(same setup as the gin index disk: SAS raid 10) is quite low comparing with the gin index disk. From my observation, looks too much data is written to the disk when the pending list of gin index is flushed to the disk. Below is the outupt of 'iostat -xm 3' on the disk when inserts hang: Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util sde 0.00 0.00 0.67 2614.00 0.08 22.94 18.03 32.94 12.61 0.38 100.00 sde 0.00 0.00 1.67 2377.33 0.17 20.43 17.73 32.00 13.44 0.42 100.00 sde 0.00 0.00 15.67 2320.33 0.23 20.13 17.85 31.99 13.73 0.43 100.00 sde 0.00 0.00 7.33 1525.00 0.12 14.02 18.90 32.00 20.83 0.65 100.00 sde 0.00 0.00 14.33 1664.67 0.12 15.54 19.10 32.00 19.06 0.60 100.00 sde 0.00 0.00 5.33 1654.33 0.04 12.07 14.94 32.00 19.22 0.60 100.00 I tried to increase work_mem but the inserts hang more time each time with less frequency. So it makes almost no difference for the total hanging time. Frequent vacuum is not a choice since the hang happens very 3-5 mins. is there any improvement I can make with pg for such data volumn(still increasing) or it's time to turn to other full text search solution such as lucene etc?