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 Performance > Re: two memory-...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 14 of 21 Topic 4044 of 4352
Post > Topic >>

Re: two memory-consuming postgres processes

by lists@[EMAIL PROTECTED] (PFC) May 2, 2008 at 11:30 PM

> I created several indices for the primary table, yes.  Sure I can do a  
> table for a volatile column, but then I'll have to create a new such  
> table for each derived column -- that's why I tried to add a column to  
> the existing table.  Yet seeing this is really slow, and I need to to  
> many derived analyses like this -- which are later scanned in other  
> computations, so should persist -- I indeed see no other way but to  
> procreate derived tables with the same key, one column per each...

	OK, so in that case, if you could do all of your derived column  
calculations in one query like this :

CREATE TABLE derived AS SELECT ... FROM ... (perform all your derived  
calculations here)

	or :

BEGIN;	<-- this is im****tant to avoid writing xlog
CREATE TABLE derived AS ...
INSERT INTO derived SELECT ... FROM ... (perform all your derived  
calculations here)
COMMIT;

	Basically, updating the entire table several times to add a few simple  
columns is a bad idea. If you can compute all the data you need in one  
query, like above, it will be much faster. Especially if you join one  
large table to several smaller ones, and as long as the huge data set  
doesn't need to be sorted (check the query plan using EXPLAIN). Try to do 

as much as possible in one query to scan the large dataset only once.

	Note that the above will be faster than updating the entire table since  
it needs to write much less data : it doesn't need to delete the old rows,
 
and it doesn't need to write the transaction log, since if the transaction
 
rolls back, the table never existed anyway. Also since your newly created 

table doesn't have any indexes, they won't need to be updated.

	If you really need to update an entire table multiple times, you will  
need to :

	- Use hardware that can handle disk writes at a decent speed (that isn't 

a characteristic of a laptop drive)
	- use MyIsam, yes (but if you need to make complex queries on the data  
afterwards, it could suck).


-- 
Sent via pgsql-performance mailing list (pgsql-performance@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
 




 21 Posts in Topic:
two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 12:24:35 
Re: two memory-consuming postgres processes
scott.marlowe@[EMAIL PROT  2008-05-02 13:30:38 
Re: two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 12:38:37 
Re: two memory-consuming postgres processes
scott.marlowe@[EMAIL PROT  2008-05-02 13:53:56 
Re: two memory-consuming postgres processes
tgl@[EMAIL PROTECTED] (T  2008-05-02 16:13:37 
Re: two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 13:26:47 
Re: two memory-consuming postgres processes
gsmith@[EMAIL PROTECTED]   2008-05-02 16:22:29 
Re: two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 13:28:42 
Re: two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 13:35:32 
Re: two memory-consuming postgres processes
scott.marlowe@[EMAIL PROT  2008-05-02 14:40:51 
Re: two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 13:51:44 
Re: two memory-consuming postgres processes
craig_james@[EMAIL PROTEC  2008-05-02 14:02:24 
Re: two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 14:09:52 
Re: two memory-consuming postgres processes
lists@[EMAIL PROTECTED]   2008-05-02 23:30:44 
Re: two memory-consuming postgres processes
gsmith@[EMAIL PROTECTED]   2008-05-02 17:23:45 
Re: two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 14:30:17 
Re: two memory-consuming postgres processes
Kevin.Grittner@[EMAIL PRO  2008-05-02 16:43:58 
Re: two memory-consuming postgres processes
deliverable@[EMAIL PROTEC  2008-05-02 15:03:12 
Re: two memory-consuming postgres processes
Kevin.Grittner@[EMAIL PRO  2008-05-02 17:29:00 
Re: two memory-consuming postgres processes
matthew@[EMAIL PROTECTED]  2008-05-03 10:25:28 
Re: two memory-consuming postgres processes
mmoncure@[EMAIL PROTECTED  2008-05-03 11:07:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sun Oct 12 14:27:55 CDT 2008.