Unix Technical Forum

Re: HOT WIP Patch - version 3.2

This is a discussion on Re: HOT WIP Patch - version 3.2 within the Pgsql Patches forums, part of the PostgreSQL category; --> Pavan Deolasee wrote: > - What do we do with the LP_DELETEd tuples at the VACUUM time ? > ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 09:36 AM
Heikki Linnakangas
 
Posts: n/a
Default Re: HOT WIP Patch - version 3.2

Pavan Deolasee wrote:
> - What do we do with the LP_DELETEd tuples at the VACUUM time ?
> In this patch, we are collecting them and vacuuming like
> any other dead tuples. But is that the best thing to do ?


Since they don't need index cleanups, it's a waste of
maintenance_work_mem to keep track of them in the dead tuples array.
Let's remove them in the 1st phase. That means trading the shared lock
for a vacuum-level lock on pages with LP_DELETEd tuples. Or if we want
to get fancy, we could skip LP_DELETEd tuples in the 1st phase for pages
that had dead tuples on them, and scan and remove them in the 2nd phase
when we have to acquire the vacuum-level lock anyway.

> - While searching for a LP_DELETEd tuple, we start from the
> first offset and return the first slot which is big enough
> to store the tuple. Is there a better search algorithm
> (sorting/randomizing) ? Should we go for best-fit instead
> of first-fit ?


Best-fit seems better to me. It's pretty cheap to scan for LP_DELETEd
line pointers, but wasting space can lead to cold updates and get much
more expensive.

You could also prune the chains on the page to make room for the update,
and if you can get a vacuum lock you can also defrag the page.

> - Should we have metadata on the heap page to track the
> number of LP_DELETEd tuples, number of HOT-update chains in the
> page and any other information that can help us optimize
> search/prune operations ?


I don't think the CPU overhead is that significant; we only need to do
the search/prune when a page gets full. We can add flags later if we
feel like it, but let's keep it simple for now.

> - There are some interesting issues in the VACUUMing area. How
> do we count the dead tuples ? Should we count HOT-updated
> tuples in the dead count ? If we do so, I noticed that
> VACUUM gets triggered on very small tables like "tellers"
> in pgbench and takes several minutes to finish because
> it waits very very long for VACUUM-strength lock on the
> index pages. Index is just a page or two in this case.


Yeah, that's not good. HOT updates shouldn't increase the n_dead_tuples
pgstat counter.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 09:37 AM
Pavan Deolasee
 
Posts: n/a
Default Re: HOT WIP Patch - version 3.2

On 2/27/07, Heikki Linnakangas <heikki@enterprisedb.com> wrote:
>
> Pavan Deolasee wrote:
> > - What do we do with the LP_DELETEd tuples at the VACUUM time ?
> > In this patch, we are collecting them and vacuuming like
> > any other dead tuples. But is that the best thing to do ?

>
> Since they don't need index cleanups, it's a waste of
> maintenance_work_mem to keep track of them in the dead tuples array.
> Let's remove them in the 1st phase. That means trading the shared lock
> for a vacuum-level lock on pages with LP_DELETEd tuples. Or if we want
> to get fancy, we could skip LP_DELETEd tuples in the 1st phase for pages
> that had dead tuples on them, and scan and remove them in the 2nd phase
> when we have to acquire the vacuum-level lock anyway.



I liked the idea of not collecting the LP_DELETEd tuples in the first
pass. We also prune the HOT-update chains in the page in the first
pass, may be that can also be moved to second pass. We need to
carefully work on the race conditions involved in the VACUUM, pruning
and tuple reuse though.


> - While searching for a LP_DELETEd tuple, we start from the
> > first offset and return the first slot which is big enough
> > to store the tuple. Is there a better search algorithm
> > (sorting/randomizing) ? Should we go for best-fit instead
> > of first-fit ?

>
> Best-fit seems better to me. It's pretty cheap to scan for LP_DELETEd
> line pointers, but wasting space can lead to cold updates and get much
> more expensive.



Ok. I will give it a shot once the basic things are ready.


You could also prune the chains on the page to make room for the update,
> and if you can get a vacuum lock you can also defrag the page.



Yes, thats a good suggestion as well. I am already doing that in the
patch I am working on right now.


> - Should we have metadata on the heap page to track the
> > number of LP_DELETEd tuples, number of HOT-update chains in the
> > page and any other information that can help us optimize
> > search/prune operations ?

>
> I don't think the CPU overhead is that significant; we only need to do
> the search/prune when a page gets full. We can add flags later if we
> feel like it, but let's keep it simple for now.




I am making good progress with the line-pointer redirection stuff.
Its showing tremendous value in keeping the table and index size
in control. But we need to check for the CPU overhead as well
and if required optimize there.



Thanks,
Pavan

--

EnterpriseDB http://www.enterprisedb.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:20 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com