From: | MichaelDBA <MichaelDBA(at)sqlexec(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Sohel Tamboli <sohel(dot)tamboli0016(at)gmail(dot)com>, pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Postgresql | Vacuum information |
Date: | 2018-02-28 21:21:29 |
Message-ID: | 5A971D59.5050000@sqlexec.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
wee bit further elaboration...
MVCC for updates is DELETE followed by INSERT. That is what the docs
are talking about when mentioning "new rows", not the type of "new row"
that is done with an INSERT statement which is ALWAYS appended to end of
table. I actually had to ask about this one in PostgreSQL slack chat
because I wasn't 100% positive that index clustering order does not
influence INSERT location, but apparently even clustering order does not
influence a location for INSERTs other than the end of the table.
We all learned something here, lol
Regards,
Michael Vitale
> MichaelDBA <mailto:MichaelDBA(at)sqlexec(dot)com>
> Wednesday, February 28, 2018 4:04 PM
> 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 <mailto:david(dot)g(dot)johnston(at)gmail(dot)com>
> Wednesday, February 28, 2018 1:37 PM
> On Wed, Feb 28, 2018 at 11:31 AM, Sohel Tamboli
> <sohel(dot)tamboli0016(at)gmail(dot)com <mailto:sohel(dot)tamboli0016(at)gmail(dot)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:
>
>
> 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 <mailto:sohel(dot)tamboli0016(at)gmail(dot)com>
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2018-02-28 21:24:01 | Re: postgresql 9.6 - cannot freeze committed xmax |
Previous Message | Alexandre Garcia | 2018-02-28 21:17:08 | Re: postgresql 9.6 - cannot freeze committed xmax |