473,383 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

postgres 8 performance

Hi all!
I am running postgres 8 beta1 and for some reason it is really slow in
execution. I am not able to figure out why.
On a fresh install of postgres, the following code executed through jdbc
********************
for (int i=0; i < 10000; i++) {
s.execute("insert into tab values (" + i + ",'" + i +
"')") ;
}
****************
This took like 700 secs to execute.
However, the weird part is that a stored proc doing the same thing via
******************************
create or replace function perftest() returns integer as '
declare
i integer := 0 ;
begin
for i in 0..10000 loop
execute ''insert into tab values ( '' || i || '' ,''''xxx''''
)'' ;
end loop ;
return 0;
end ;

does the same thing in less than a second.

*************************************
I can't figure out what the problem is.
The app using jdbc and the postmaster instance were running on the same
comp so I can't believe that communication would make that big a hit on
performance.

Is there something else that I am doing wrong?
Finally, where can I look up some useful performance tuning tips to get my
server to run faster anyway?

thanks a lot
paramveer singh

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
4 1418

Add a begin/commit on that so you dont have 10k transactions ?

BEGIN
********************
for (int i=0; i < 10000; i++) {
s.execute("insert into tab values (" + i + ",'" + i +
"')") ;
}
****************

COMMIT

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #2
I can't figure out what the problem is.
The app using jdbc and the postmaster instance were running on the same
comp so I can't believe that communication would make that big a hit on
performance.


It's the query parsing that takes a lot of time.
You might want to look at prepared statements:
http://java.sun.com/docs/books/tutor.../prepared.html

Also set autocommit to off and do a hundert or so inserts inside
one transaction, not one transaction for each insert.

Bye, Chris.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
On Tue, 7 Sep 2004 Pa*************@trilogy.com wrote:

<snip>
Finally, where can I look up some useful performance tuning tips to get my
server to run faster anyway?


* http://www.varlena.com/varlena/Gener...ed_conf_e.html
* http://www.varlena.com/varlena/Gener...bits/perf.html
* Join pgsql-perform list.

Regards,
- --
Devrim GUNDUZ
devrim~gunduz.org devrim.gunduz~linux.org.tr
http://www.tdmsoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBPY4ctl86P3SPfQ4RAuSaAJ0daOhwnIUVjwR1qmQu9G BeFTCB5wCfZdN/
xlW//4jr8EOIhZil1qyGYSY=
=QlCi
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #4

On 07/09/2004 11:12 Pa*************@trilogy.com wrote:
Hi all!
I am running postgres 8 beta1 and for some reason it is really slow in
execution. I am not able to figure out why.
On a fresh install of postgres, the following code executed through jdbc

[snip]
I can't figure out what the problem is.
The app using jdbc and the postmaster instance were running on the same
comp so I can't believe that communication would make that big a hit on
performance.


Each of your JDBC inserts is being performed in a different transaction
whilst your stored procedure is being executed is a single transaction. If
you want to speed up the JDBC inserts, use setAutoCommit(false) on the
connection object then do a connection.commit() at the end. If you really
are taking 700 seconds, you've probably also got a network misconfiguration
somewhere as well. 50-100 seconds would be more realistic even on fairly
slow hardware.

--
Paul Thomas
+------------------------------+-------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for Business |
| Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+-------------------------------------------+

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: wlcna | last post by:
mysql v4.0.16: I had been using mysql with innodb and thought that was fine, until i used it for something requiring a few - perhaps slightly involved - joins, and have now seen the performance...
2
by: Ksenia Marasanova | last post by:
Hi, I wonder if anyone on this list is using Python as Postgres procedural language. I can't find a place for it i my mind. How would a typical MVC web application benefit from it (besides...
3
by: John Wells | last post by:
Guys, Bruce mentioned I should repost this with Progress in the title. My friend's company is desperately trying to move from Progress to an open platform and is seriously considering Postgres...
7
by: Ken Guest | last post by:
Folks, I have a question or two regarding PHP and Postgres on the issue of speed: 1. Is the semicolon at the end of SQL superflous when sent to Postgres? Should it make much of a difference if I...
3
by: Gaetano Mendola | last post by:
I found this article: http://www.serverwatch.com/news/article.php/10824_1126981_Ext that is clear out dated, it's anyway a good comparison with mysql. Do you know if someone did the TPC-C...
1
by: Hank | last post by:
Hello, We are in the process of migrating our Access back end to Postgres. Our current version is Access 2000. Among other issues, the reason for the change is to pick up some speed by way of...
7
by: David Teran | last post by:
Hi, maybe anyone already knows that Apple is distributing Postgres 7.3.3 with RemoteDesktop 2. Its located in /System/Library/CoreServices/RemoteManagement/rmdb.bundle/ BUT... they did not do...
18
by: Joe Lester | last post by:
This thread was renamed. It used to be: "shared_buffers Question". The old thread kind of died out. I'm hoping to get some more direction by rephrasing the problem, along with some extra...
3
by: ruben20 | last post by:
Hi: Our postgres database has tables with several million rows in a server running Red Hat 8.0 with 1GB of memory. Recently we are experiencing a low performance in the access to the server via...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.