Computing.Net > Forums > Linux > C-prog inserts in mySql slowly

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C-prog inserts in mySql slowly

Reply to Message Icon

Name: HenryMonster
Date: October 17, 2002 at 12:43:54 Pacific
OS: Linux & FreeBSD
CPU/Ram: Intel, 1Gb
Comment:

Hi All,

I have a FreeBSD production server and
a Linux-box, which we use for development
and as our ftp server at the same time.

Both machines host the same version of mySql: 3.23

I developed a simple C-program, which parses
ascii-files, which we receive daily
through ftp on our Linux machine from our
business partner and inserts new
records into a table (47 fields per record).

My manager want to run this program from Linux only !

When I run the program against our development mySql database on this same Linux machine, it processes
200 records in 3-5 seconds.

However when I run the same program (on Linux)
against our production database, it takes 7-10 minutes
to process the same number of records.

The tables & indexes are identical in both development and
production databases. The workload of the FreeBSD machine
is less than moderate (it can be deemed as idle).

ANY IDEA WHAT COULD CONTRIBUTE TO SUCH
DRASTIC PERFORMANCE DROP ?

Thank you very much in advance !

... and this is now becoming urgent :(


Henry Monster.




Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: October 18, 2002 at 04:48:50 Pacific
Reply:

There are likely network resolutions issues at hand. 200 records in 3 seconds. That's OK. Are other network protocols as slow - rlogin, rcp ? You might add an entry in the server's /etc/host file to eliminate calls to a dns server.
Also the load data infile syntax is about 20 times faster than a series of sql insert commands.


0

Response Number 2
Name: HenryMonster
Date: October 18, 2002 at 07:19:36 Pacific
Reply:

David,

Thank you for your response!

I'll check what you suggest.

What surprises me is that I run all my
INSERT statements through the same
connection to mySql database and
I open this connection just once
when the program starts. I assumed that
mySql C-client resolves
the database server name once when it
establishes the connection and then saves
the IP address in a memory structure
as long as the connection is open.

Henry M.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: C-prog inserts in mySql slowly

shellscript for gps log inserting into mysql www.computing.net/answers/linux/shellscript-for-gps-log-inserting-into-mysql/30307.html

A problem in MYSQL & PHP..... www.computing.net/answers/linux/a-problem-in-mysql-amp-php/13142.html

problems running c++ prog. www.computing.net/answers/linux/problems-running-c-prog/11204.html