Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1er8ti-00039b-9l for pgsql-admin@arkaria.postgresql.org; Wed, 28 Feb 2018 21:04:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1er8tg-0003xE-IF for pgsql-admin@arkaria.postgresql.org; Wed, 28 Feb 2018 21:04:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1er8tg-0003wB-AO for pgsql-admin@lists.postgresql.org; Wed, 28 Feb 2018 21:04:20 +0000 Received: from mout.perfora.net ([74.208.4.196]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1er8tc-000206-NM for pgsql-admin@postgresql.org; Wed, 28 Feb 2018 21:04:19 +0000 Received: from [192.168.1.101] ([98.169.215.140]) by mrelay.perfora.net (mreueus003 [74.208.5.2]) with ESMTPSA (Nemesis) id 0LfhYy-1eO8wh0PHu-00pOks; Wed, 28 Feb 2018 22:04:13 +0100 Message-ID: <5A97194B.30709@sqlexec.com> Date: Wed, 28 Feb 2018 16:04:11 -0500 From: MichaelDBA User-Agent: Postbox 5.0.22 (Windows/20171208) MIME-Version: 1.0 To: "David G. Johnston" CC: Sohel Tamboli , pgsql-admin@postgresql.org Subject: Re: Postgresql | Vacuum information References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------070705040200080300060603" X-Provags-ID: V03:K0:yTvqdQcYIenq25wgJwgfmsGexNIuMA8ey3xLOwdWsx8BIMGH6sJ DGH1FeJEb8LyBU+tpreUbJtc+t9Rp7cZAsJy0eA1wvXfC6sEEqi43a0EPHlPIlwpZSdfDg+ GGjB8UJSpwOFcfq+4f2uIkqH07YqkZNb/nwiOSUqvfC3xXcgh0+doH5gu7XnVk4919Yuhpg yKJu4QwNJ2cM+cRRubt6w== X-UI-Out-Filterresults: notjunk:1;V01:K0:PMAIVtfXop0=:VYLuIZfgY3Q/r2OEiYf89V OStYHgdaR7HPCVYGfziNKP+4cuMFrvOy6hgTfCgFSzJrCtrmHhL+4qaINtY3bl2cWfnmpbMPd 8Z4rvE+ba/xAqTF9fILtfWYOmYIFkP+JuJRqILOMjlm72Gr1lGdEmYskqAPxsapmjE0ve4itB rg6ws7yt/sntbYABoAdK5d0/CbmOTN+72O3kiDjMXpsbYEZhtF8DfQB+qu0rCSKiBoYO0KBCD jiYQFDrRVgmSyQJTXGZH6SEj5nXN7fJoZTNuACnNYShLVarSQMQgc9dFeRI79OSkIqmZIqLmJ n05+B/GjSypOlj213NTMqEt/o5dnW2XArPWGypL+fl4Let44+0sY8RUU0XzTVYQIFDIffGq2K uCaq+OvqmgEZNedjES4IEzQMCGhF3Pune83lnexQCYYU4DEeEXR3QaucsmTqRxzd16dcpN5+y hTgqoFPWvP5zqDF0u4q4IBn/ZGcv4d3i81NyGNKCbHGJyIeIFq8fPHuar0sylXzuZ6tsY+ZwD VnZo5S6RwVlXYQ/yyxFJkEVYmC8m4LK0C5eCSfi9v48nc9n525ifSfRc/u4ohZYhm9P7DAnJp Xurl/JKduZ76dKizeGcJYJEhpMR9Qyp0JgATvnZNCIv9MkK4VYF+AF4FHxsFlP5InYgF7W0ht GcmJGcP1c++NPdmc8cZJgcPnZhqg3rHii+M+iEP9to5k3LsjHx92br/oS8veKm79UB/hfeB/H 2DoSgyMnNX6VwtcinK/w+j4LSfsGKOG/H4M94QWxOH14eLe6+JigCP1B208= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------070705040200080300060603 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Actually, David, that reference to the docs about "new rows" in https://www.postgresql.org/docs/10/static/routine-vacuuming.html#VACUUM-BASICS, recovering disk space, relates to UPDATEs and DELETEs, not INSERTs. The main gain for reusing dead space is where UPDATES are concerned where it will try to insert on the same page if possible. Regards, Michael Vitale > David G. Johnston > Wednesday, February 28, 2018 1:37 PM > On Wed, Feb 28, 2018 at 11:31 AM, Sohel Tamboli > >wrote: > > Hi, > > I need some information on vacuum in postgresql. I know that > "vacuum full" recreate full table and releases space to OS. Only > "vacuum" clears the dead tuples and free the space but does not > returns free space to OS, indeed it keeps free space as a part of > table. > My question is, after running only "vacuum", how does new data or > insert is written to the table? I need to know that Does new data > gets inserted in free space available in between of live tuples or > gets inserted at the end of table everytime. > > > There would be no point to non-full vacuuming if "new data [was] > inserted ... at the end of the table everytime"...​ > > ​ This logic is also documented:​ > > ​ > https://www.postgresql.org/docs/10/static/routine-vacuuming.html#VACUUM-BASICS > ​ > > ​" > The space it occupies must then be reclaimed for reuse by new rows, to > avoid unbounded growth of disk space requirements. This is done by > running VACUUM. > ​"​ > > ​ David J. > > Sohel Tamboli > Wednesday, February 28, 2018 1:31 PM > Hi, > > I need some information on vacuum in postgresql. I know that "vacuum > full" recreate full table and releases space to OS. Only "vacuum" > clears the dead tuples and free the space but does not returns free > space to OS, indeed it keeps free space as a part of table. > My question is, after running only "vacuum", how does new data or > insert is written to the table? I need to know that Does new data gets > inserted in free space available in between of live tuples or gets > inserted at the end of table everytime. > > Appreciate your quick response!! > > Thanks, > Sohel --------------070705040200080300060603 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Actually, David, that reference to the docs about "new rows" in https://www.postgresql.org/docs/10/static/routine-vacuuming.html#VACUUM-BASICS, recovering disk space, relates to UPDATEs and DELETEs, not INSERTs.  The main gain for reusing dead space is where UPDATES are concerned where it will try to insert on the same page if possible.

Regards,
Michael Vitale
Wednesday, February 28, 2018 1:37 PM
On Wed, Feb 28, 2018 at 11:31 AM, Sohel Tamboli <sohel.tamboli0016@gmail.com> wrote:
Hi, 

I need some information on vacuum in postgresql. I know that "vacuum full" recreate full table and releases space to OS. Only "vacuum" clears the dead tuples and free the space but does not returns free space to OS, indeed it keeps free space as a part of table. 
My question is, after running only "vacuum", how does new data or insert is written to the table? I need to know that Does new data gets inserted in free space available in between of live tuples or gets inserted at the end of table everytime. 


There would be no point to non-full vacuuming if "new data [was] inserted ... at the end of the table everytime"...​

​ This logic is also documented:​

​"
The space it occupies must then be reclaimed for reuse by new rows, to avoid unbounded growth of disk space requirements. This is done by running VACUUM.
​"​

​ David J.

Wednesday, February 28, 2018 1:31 PM
Hi, 

I need some information on vacuum in postgresql. I know that "vacuum full" recreate full table and releases space to OS. Only "vacuum" clears the dead tuples and free the space but does not returns free space to OS, indeed it keeps free space as a part of table. 
My question is, after running only "vacuum", how does new data or insert is written to the table? I need to know that Does new data gets inserted in free space available in between of live tuples or gets inserted at the end of table everytime. 

Appreciate your quick response!! 

Thanks, 
Sohel

--------------070705040200080300060603--