[PERFORM] Performance die when COPYing to table with bigint PK

2011-07-31 Thread Robert Ayrapetyan
Hello. I've found strange behavior of my pg installation (tested both 8.4 and 9.0 - they behave same) on FreeBSD platform. In short - when some table have PK on bigint field - COPY to that table from file becomes slower and slower as table grows. When table reaches ~5GB - COPY of 100k records may

Re: [PERFORM] heavy load-high cpu itilization

2011-07-31 Thread Filippos
thx a lot for your answer. i will provide some stats, so if you could help me figure out the source of the problem that would be great -*top -c* Tasks: 1220 total, 49 running, 1171 sleeping, 0 stopped, 0 zombie Cpu(s): *84.1%us*, 2.8%sy, 0.0%ni, 12.3%id, 0.1%wa, 0.1%hi, 0.6%si, 0.0%st

Re: [PERFORM] insert

2011-07-31 Thread Gavin Flower
On 30/07/11 08:14, Kevin Grittner wrote: alan wrote: Can I write a BEFORE ROW trigger for the products table to runs on INSERT or UPDATE to 1. insert a new category& return the new category_id OR 2. return the existing category_id for the (to be inserted row) What would you be using

Re: [PERFORM] Trigger or Function

2011-07-31 Thread Gavin Flower
On 24/07/11 03:58, alan wrote: My first approach would be to remove WeekAvg and MonthAvg from the table and create a view which calculates appropriate values. Thanks Robert, I had to upgrade to 9.0.4 to use the extended windowing features. Here is how I set it up. If anyone sees an issue, please

Re: [PERFORM] heavy load-high cpu itilization

2011-07-31 Thread Filippos
thx a lot for your answer. i will provide some stats, so if you could help me figure out the source of the problem that would be great -top -c Tasks: 1220 total, 49 running, 1171 sleeping, 0 stopped, 0 zombie Cpu(s): 84.1%us, 2.8%sy, 0.0%ni, 12.3%id, 0.1%wa, 0.1%hi, 0.6%si, 0.0%st Mem: