Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: Unloading a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 6 Topic 15443 of 17602
Post > Topic >>

Re: Unloading a table consistently

by ptjm@[EMAIL PROTECTED] (Patrick TJ McPhee) May 3, 2008 at 11:29 PM

In article <9478.1209833817@[EMAIL PROTECTED]
>, Tom Lane <tgl@[EMAIL PROTECTED]
>
wrote:

% If you can't tolerate locking out writers for that long, you won't
% be able to use TRUNCATE.  The operation I think you were imagining is
% 
% BEGIN;
% SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
% COPY log TO 'filename-path';
% DELETE FROM log;
% COMMIT;
% VACUUM log;	-- highly recommended at this point

How about something along the lines of

BEGIN;
ALTER TABLE log RENAME to log_old;
CREATE TABLE log(...);
COMMIT;

BEGIN;
LOCK table log_old;
COPY log_old TO 'filename-path';
DROP TABLE log_old;
COMMIT;

I believe this will keep the writers writing while keeping the efficiency
of truncating.
-- 

Patrick TJ McPhee
North York  Canada
ptjm@[EMAIL PROTECTED]

 




 6 Posts in Topic:
Unloading a table consistently
xof@[EMAIL PROTECTED] (C  2008-05-03 09:11:16 
Re: Unloading a table consistently
tgl@[EMAIL PROTECTED] (T  2008-05-03 12:56:57 
Re: Unloading a table consistently
xof@[EMAIL PROTECTED] (C  2008-05-03 10:24:36 
Re: Unloading a table consistently
ptjm@[EMAIL PROTECTED] (  2008-05-03 23:29:11 
Re: Unloading a table consistently
craig@[EMAIL PROTECTED]   2008-05-04 23:28:16 
Re: Unloading a table consistently
xof@[EMAIL PROTECTED] (C  2008-05-04 12:07:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 19:11:11 CST 2008.