Re: [HACKERS] Setting visibility map in VACUUM's second phase

2013-02-13 Thread Heikki Linnakangas
On 03.02.2013 08:24, Pavan Deolasee wrote: On Sun, Feb 3, 2013 at 2:31 AM, Jeff Janes wrote: I've attached a patch with these changes made. Does this look OK? Looks good to me. I also repeated pgbench and make check and they work as expected. I'll add it to the CF and also mark the patch "re

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2013-02-02 Thread Pavan Deolasee
On Sun, Feb 3, 2013 at 2:31 AM, Jeff Janes wrote: > Hi Pavan, > > I get this warning: > vacuumlazy.c:890: warning: passing argument 6 of 'lazy_vacuum_page' > makes pointer from integer without a cast > > and make check then fails. > > I've added '&' to that line, and it now passes make check with

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2013-02-02 Thread Jeff Janes
On Sat, Jan 26, 2013 at 11:25 PM, Pavan Deolasee wrote: > On Thu, Jan 24, 2013 at 9:31 PM, Jeff Janes wrote: >> On Thu, Jan 24, 2013 at 1:28 AM, Pavan Deolasee >> wrote: > >>> >>> Good idea. Even though the cost of pinning/unpinning may not be high >>> with respect to the vacuum cost itself, but

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2013-01-26 Thread Pavan Deolasee
On Thu, Jan 24, 2013 at 9:31 PM, Jeff Janes wrote: > On Thu, Jan 24, 2013 at 1:28 AM, Pavan Deolasee > wrote: >> >> Good idea. Even though the cost of pinning/unpinning may not be high >> with respect to the vacuum cost itself, but it seems to be a good idea >> because we already do that at othe

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2013-01-24 Thread Jeff Janes
On Thu, Jan 24, 2013 at 1:28 AM, Pavan Deolasee wrote: > Hi Jeff, > > On Thu, Jan 24, 2013 at 2:41 PM, Jeff Janes wrote: >> >> lazy_vacuum_page now pins and unpins the vmbuffer for each page it marks >> all-visible, which seems like a lot of needless traffic since the next >> vmbuffer is likely t

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2013-01-24 Thread Pavan Deolasee
Hi Jeff, On Thu, Jan 24, 2013 at 2:41 PM, Jeff Janes wrote: > > lazy_vacuum_page now pins and unpins the vmbuffer for each page it marks > all-visible, which seems like a lot of needless traffic since the next > vmbuffer is likely to be the same as the previous one. > Good idea. Even though the

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2013-01-24 Thread Jeff Janes
On Friday, December 7, 2012, Pavan Deolasee wrote: > Revised patch attached. This time much less invasive. I added a new > function heap_page_is_all_visible() to check if the given page is > all-visible and also return the visibility cutoff xid. Hi Pavan, lazy_vacuum_page now pins and unpins t

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2012-12-07 Thread Pavan Deolasee
On Fri, Dec 7, 2012 at 9:21 AM, Pavan Deolasee wrote: > On Thu, Dec 6, 2012 at 11:31 PM, Tom Lane wrote: > >> >> I think taking a second whack at setting the visibility bit is a fine >> idea, but let's drop all the rest of this premature optimization. >> > > Fair enough. I thought about doing it

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2012-12-06 Thread Amit Kapila
On Friday, December 07, 2012 12:06 AM Robert Haas wrote: > On Thu, Dec 6, 2012 at 1:01 PM, Tom Lane wrote: > > I think taking a second whack at setting the visibility bit is a fine > > idea, but let's drop all the rest of this premature optimization. > > +1. > > If there's any optimization neede

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2012-12-06 Thread Pavan Deolasee
On Fri, Dec 7, 2012 at 12:05 AM, Robert Haas wrote: > On Thu, Dec 6, 2012 at 1:01 PM, Tom Lane wrote: >> I think taking a second whack at setting the visibility bit is a fine >> idea, but let's drop all the rest of this premature optimization. > > +1. > > If there's any optimization needed here,

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2012-12-06 Thread Pavan Deolasee
On Thu, Dec 6, 2012 at 11:31 PM, Tom Lane wrote: > > I think taking a second whack at setting the visibility bit is a fine > idea, but let's drop all the rest of this premature optimization. > Fair enough. I thought about doing it that way but was worried that an additional page scan will raise

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2012-12-06 Thread Tom Lane
Robert Haas writes: > One other thought: I'm wondering if we shouldn't try to push the work > of setting the all-visible bit into heap_page_prune(). Hm, maybe ... > But it seems to me that a page can't be all-visible unless there are > no dead line pointers and no HOT chains of length != 1, and

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2012-12-06 Thread Robert Haas
On Thu, Dec 6, 2012 at 1:01 PM, Tom Lane wrote: > I think taking a second whack at setting the visibility bit is a fine > idea, but let's drop all the rest of this premature optimization. +1. If there's any optimization needed here, we should try to do it by remembering relevant details from the

Re: [HACKERS] Setting visibility map in VACUUM's second phase

2012-12-06 Thread Tom Lane
Pavan Deolasee writes: > So the idea that the patch implements is this. When we scan pages in > the first phase of vacuum, if we find a page that has all-visible > tuples but also has one or more dead tuples that we know the second > phase of vacuum will remove, we mark such page with a special fl

[HACKERS] Setting visibility map in VACUUM's second phase

2012-12-06 Thread Pavan Deolasee
Hi All, I briefly mentioned this idea in one of the other thread, but starting a new thread to highlight the point. Today, we set the visibility map *only* in the first phase of vacuum. This works when the page has no dead tuples. But the vacuum itself is removing one or more dead tuples from the