

Nobody likes to take the time to move discussions, do they?  And ya, I'm
about as guilty *sigh*

Move to pgsql-hackers@postgresql.org...


On Tue, 3 Feb 1998, Herouth Maoz wrote:

> At 15:01 +0200 on 2/2/98, The Hermit Hacker wrote:
> 
> I think the garbage collection should be separated from the statistics.
> Garbage collection needs a write lock, statistics only a read lock. If they
> are not done at the same time, the various tables would be locked for
> shorter periods.

	Hrmmmm...good point, I think.  Bruce?  Vadim?  When vacuum'ng a
large table, how much time is spend 'garbage collecting' vs 'statistics'?
I thought that 'vacuum analyze' *was* the statistics aspect of it?  Where
just 'vacuum' was only garbage collection...?



Tue, 3 Feb 1998 07:10:16 -0500 (EST)
The Hermit Hacker <scrappy@hub.org>
Re: [QUESTIONS] MySQL benchmark page
> 
> 
> 
> Nobody likes to take the time to move discussions, do they?  And ya, I'm
> about as guilty *sigh*
> 
> Move to pgsql-hackers@postgresql.org...
> 
> 
> On Tue, 3 Feb 1998, Herouth Maoz wrote:
> 
> > At 15:01 +0200 on 2/2/98, The Hermit Hacker wrote:
> > 
> > I think the garbage collection should be separated from the statistics.
> > Garbage collection needs a write lock, statistics only a read lock. If they
> > are not done at the same time, the various tables would be locked for
> > shorter periods.
> 
> 	Hrmmmm...good point, I think.  Bruce?  Vadim?  When vacuum'ng a
> large table, how much time is spend 'garbage collecting' vs 'statistics'?
> I thought that 'vacuum analyze' *was* the statistics aspect of it?  Where
> just 'vacuum' was only garbage collection...?

This is correct.  Vacuum is fast, vacuum analyze is pretty slow.  We
could separate them, I guess, and that would eliminate the write-lock
and be only a readlock.

-- 
Bruce Momjian
maillist@candle.pha.pa.us

Tue, 3 Feb 1998 13:22:22 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
On Tue, 3 Feb 1998, Bruce Momjian wrote:

> > On Tue, 3 Feb 1998, Herouth Maoz wrote:
> > 
> > > At 15:01 +0200 on 2/2/98, The Hermit Hacker wrote:
> > > 
> > > I think the garbage collection should be separated from the statistics.
> > > Garbage collection needs a write lock, statistics only a read lock. If they
> > > are not done at the same time, the various tables would be locked for
> > > shorter periods.
> > 
> > 	Hrmmmm...good point, I think.  Bruce?  Vadim?  When vacuum'ng a
> > large table, how much time is spend 'garbage collecting' vs 'statistics'?
> > I thought that 'vacuum analyze' *was* the statistics aspect of it?  Where
> > just 'vacuum' was only garbage collection...?
> 
> This is correct.  Vacuum is fast, vacuum analyze is pretty slow.  We
> could separate them, I guess, and that would eliminate the write-lock
> and be only a readlock.

	Possible to slip it in for v6.3?  Would make it so that an analyze
could be done nightly, to keep statistics up, and then a vacuum once a
week or so just for garbage collection...?



Tue, 3 Feb 1998 13:46:22 -0500 (EST)
The Hermit Hacker <scrappy@hub.org>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
> > This is correct.  Vacuum is fast, vacuum analyze is pretty slow.  We
> > could separate them, I guess, and that would eliminate the write-lock
> > and be only a readlock.
> 
> 	Possible to slip it in for v6.3?  Would make it so that an analyze
> could be done nightly, to keep statistics up, and then a vacuum once a
> week or so just for garbage collection...?

When I added analyze, I did not understand the issues, so I was able to
work from Vadim's code in vacuum.  I put it on the TODO list.  Don't
know if it can make 6.3.  I am working on cleaning up the cacheoffset
code right now.

-- 
Bruce Momjian
maillist@candle.pha.pa.us

Tue, 3 Feb 1998 14:30:09 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
On Tue, 3 Feb 1998, Bruce Momjian wrote:

> > > This is correct.  Vacuum is fast, vacuum analyze is pretty slow.  We
> > > could separate them, I guess, and that would eliminate the write-lock
> > > and be only a readlock.
> > 
> > 	Possible to slip it in for v6.3?  Would make it so that an analyze
> > could be done nightly, to keep statistics up, and then a vacuum once a
> > week or so just for garbage collection...?
> 
> When I added analyze, I did not understand the issues, so I was able to
> work from Vadim's code in vacuum.  I put it on the TODO list.  Don't
> know if it can make 6.3.  I am working on cleaning up the cacheoffset
> code right now.

	Okay...personally, I'm finding 'vacuum <table>' an acceptable work
around, so it isn't too big of a priority :)



Tue, 3 Feb 1998 14:30:57 -0500 (EST)
The Hermit Hacker <scrappy@hub.org>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
> 
> On Tue, 3 Feb 1998, Bruce Momjian wrote:
> 
> > > > This is correct.  Vacuum is fast, vacuum analyze is pretty slow.  We
> > > > could separate them, I guess, and that would eliminate the write-lock
> > > > and be only a readlock.
> > > 
> > > 	Possible to slip it in for v6.3?  Would make it so that an analyze
> > > could be done nightly, to keep statistics up, and then a vacuum once a
> > > week or so just for garbage collection...?
> > 
> > When I added analyze, I did not understand the issues, so I was able to
> > work from Vadim's code in vacuum.  I put it on the TODO list.  Don't
> > know if it can make 6.3.  I am working on cleaning up the cacheoffset
> > code right now.
> 
> 	Okay...personally, I'm finding 'vacuum <table>' an acceptable work
> around, so it isn't too big of a priority :)
> 

Vacuum probably write-locks the pg_class table because it updates the
table statistics.  By vacuuming one table at a time, your lock is
removed and re-asserted, allowing other people to get into pg_class, and
a scan of pg_class is not necessary becuase you supply the table names. 

-- 
Bruce Momjian
maillist@candle.pha.pa.us

Tue, 3 Feb 1998 14:40:03 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
On Tue, 3 Feb 1998, Bruce Momjian wrote:

> > 
> > On Tue, 3 Feb 1998, Bruce Momjian wrote:
> > 
> > > > > This is correct.  Vacuum is fast, vacuum analyze is pretty slow.  We
> > > > > could separate them, I guess, and that would eliminate the write-lock
> > > > > and be only a readlock.
> > > > 
> > > > 	Possible to slip it in for v6.3?  Would make it so that an analyze
> > > > could be done nightly, to keep statistics up, and then a vacuum once a
> > > > week or so just for garbage collection...?
> > > 
> > > When I added analyze, I did not understand the issues, so I was able to
> > > work from Vadim's code in vacuum.  I put it on the TODO list.  Don't
> > > know if it can make 6.3.  I am working on cleaning up the cacheoffset
> > > code right now.
> > 
> > 	Okay...personally, I'm finding 'vacuum <table>' an acceptable work
> > around, so it isn't too big of a priority :)
> > 
> 
> Vacuum probably write-locks the pg_class table because it updates the
> table statistics.  By vacuuming one table at a time, your lock is
> removed and re-asserted, allowing other people to get into pg_class, and
> a scan of pg_class is not necessary becuase you supply the table names. 

	Wait, then I think I got this backwards.

	Vacuum right now locks pg_class because of the statistics?  If
that is the case, if we made vacuum *just* garbage collecting,it wouldn't
have to lock pg_class, only "vacuum analyze" wouldhave to do that?

	So, I was misunderstanding in that I was thinking that 'vacuum
analyze' only needed the read-lock :(



Tue, 3 Feb 1998 14:42:18 -0500 (EST)
The Hermit Hacker <scrappy@hub.org>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
> 
> On Tue, 3 Feb 1998, Bruce Momjian wrote:
> 
> > > 
> > > On Tue, 3 Feb 1998, Bruce Momjian wrote:
> > > 
> > > > > > This is correct.  Vacuum is fast, vacuum analyze is pretty slow.  We
> > > > > > could separate them, I guess, and that would eliminate the write-lock
> > > > > > and be only a readlock.
> > > > > 
> > > > > 	Possible to slip it in for v6.3?  Would make it so that an analyze
> > > > > could be done nightly, to keep statistics up, and then a vacuum once a
> > > > > week or so just for garbage collection...?
> > > > 
> > > > When I added analyze, I did not understand the issues, so I was able to
> > > > work from Vadim's code in vacuum.  I put it on the TODO list.  Don't
> > > > know if it can make 6.3.  I am working on cleaning up the cacheoffset
> > > > code right now.
> > > 
> > > 	Okay...personally, I'm finding 'vacuum <table>' an acceptable work
> > > around, so it isn't too big of a priority :)
> > > 
> > 
> > Vacuum probably write-locks the pg_class table because it updates the
> > table statistics.  By vacuuming one table at a time, your lock is
> > removed and re-asserted, allowing other people to get into pg_class, and
> > a scan of pg_class is not necessary becuase you supply the table names. 
> 
> 	Wait, then I think I got this backwards.
> 
> 	Vacuum right now locks pg_class because of the statistics?  If
> that is the case, if we made vacuum *just* garbage collecting,it wouldn't
> have to lock pg_class, only "vacuum analyze" wouldhave to do that?
> 
> 	So, I was misunderstanding in that I was thinking that 'vacuum
> analyze' only needed the read-lock :(

Maybe I am wrong.  I have not looked at it.

-- 
Bruce Momjian
maillist@candle.pha.pa.us

Tue, 3 Feb 1998 14:43:31 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
On Tue, 3 Feb 1998, Bruce Momjian wrote:

> > 	Vacuum right now locks pg_class because of the statistics?  If
> > that is the case, if we made vacuum *just* garbage collecting,it wouldn't
> > have to lock pg_class, only "vacuum analyze" wouldhave to do that?
> > 
> > 	So, I was misunderstanding in that I was thinking that 'vacuum
> > analyze' only needed the read-lock :(
> 
> Maybe I am wrong.  I have not looked at it.

	Okay, just sitting here thinking about it, and that doesn't really
make sense (if its true)...

	Vacuum should be locking the table itself for a garbage cleanup,
since it has to move around records, and I wouldn't imagine you'd want to
have someone doing a SELECT at the same time.  So, that locks the *table*
itself, but shouldn't affect pg_class (statistically)

	Once the vacuum is finished its garbage cleanup phase (which,
granted, could take several minutes), then the statistics phase would come
into play...but again, a lock on pg_class shouldn't have to be imposed
until the 'update' of the table takes place, should it?  

	So, why is pg_class locked for the duration of a vacuum when the
vacuum is being performed for the whole database when it should (I think)
only need to be locked when updates are happening to it?



Tue, 3 Feb 1998 15:02:00 -0500 (EST)
The Hermit Hacker <scrappy@hub.org>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
The Hermit Hacker wrote:
> 
>         So, why is pg_class locked for the duration of a vacuum when the
> vacuum is being performed for the whole database when it should (I think)
> only need to be locked when updates are happening to it?

Yes, this is how it should be. This long lock comes from very old time.
When I visited vacuum last time (year ago) I hadn't time to decide
why this lock is here and could it be just removed or not. 
Still no time :)

Vadim

Wed, 04 Feb 1998 09:14:09 +0700
"Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
> 
> The Hermit Hacker wrote:
> > 
> >         So, why is pg_class locked for the duration of a vacuum when the
> > vacuum is being performed for the whole database when it should (I think)
> > only need to be locked when updates are happening to it?
> 
> Yes, this is how it should be. This long lock comes from very old time.
> When I visited vacuum last time (year ago) I hadn't time to decide
> why this lock is here and could it be just removed or not. 
> Still no time :)
> 
> Vadim
> 
> 

Added to TODO:

	* Make VACUUM on database not lock pg_class
	* Make VACUUM ANALYZE only use a readlock




-- 
Bruce Momjian
maillist@candle.pha.pa.us

Tue, 3 Feb 1998 21:37:51 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page\
Bruce Momjian wrote:
> 
> Added to TODO:
> 
>         * Make VACUUM on database not lock pg_class

Ok.

>         * Make VACUUM ANALYZE only use a readlock

??? Vacuum analyze means: do vacuuming and analyzing, yes ?
Vacuuming need in write-lock... 
There should be seperate command - ANALYZE, - when only
read-lock would be used.

Vadim

Wed, 04 Feb 1998 09:59:35 +0700
"Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page\
> 
> Bruce Momjian wrote:
> > 
> > Added to TODO:
> > 
> >         * Make VACUUM on database not lock pg_class
> 
> Ok.
> 
> >         * Make VACUUM ANALYZE only use a readlock
> 
> ??? Vacuum analyze means: do vacuuming and analyzing, yes ?
> Vacuuming need in write-lock... 
> There should be seperate command - ANALYZE, - when only
> read-lock would be used.

OK.


-- 
Bruce Momjian
maillist@candle.pha.pa.us

Tue, 3 Feb 1998 23:45:53 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page\