473,473 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MySQL timing out

Jim
Hi,

When I try to pull out all my data out, the DB appears to be timing out
before I get all the data.

There is not a where clause in the select.

Is there a way I can speed up the query?

it is pretty simple

select
a,b,c,d from table
order by a desc

OR

can I increase the timeout for the DB?

Thank you,

Jim

Jul 23 '05 #1
5 1688
how do you get your data ? what tool are you using ?

"Jim" <jf*****@gmail.com> ¦b¶l¥ó
news:11**********************@g49g2000cwa.googlegr oups.com ¤¤¼¶¼g...
Hi,

When I try to pull out all my data out, the DB appears to be timing out
before I get all the data.

There is not a where clause in the select.

Is there a way I can speed up the query?

it is pretty simple

select
a,b,c,d from table
order by a desc

OR

can I increase the timeout for the DB?

Thank you,

Jim

Jul 23 '05 #2
Jim
I am using a Perl script to pull out the data.

use Win32::ODBC;

Thank you,

Jim

Jul 23 '05 #3
Jim
Here is the code, it may not be a timeout problem. I am getting about
4200 records out of 80000

sub update_rate_fields
{
$row=1;
# "DB DSN" points to MySQL server and "test_aces_data" DB
$DSN = "DB";

# Make new ODBC object and connect to the server
if (!($rates = new Win32::ODBC($DSN)))
{
print "Error connecting to $DSN\n";
print "Error: " . Win32::ODBC::Error() . "\n";
exit;
}

# Make new ODBC object and connect to the server
if (!($insert_rates = new Win32::ODBC($DSN)))
{
print "Error connecting to $DSN\n";
print "Error: " . Win32::ODBC::Error() . "\n";
exit;
}

# Query to load all data
$reviews_query =
"select
id,
total_num_of_errors,
amount_to_be_inspected,
amount_actually_inspected,
meeting_time,
total_prep_time_hours,
inspected_item_type
from tcgaz_inspections
order by id desc";
# Execute on data
if ($rates -> Sql($reviews_query))
{
# We have an error if we got here
print "SQL failed.\n";
print "Error: " . $rates->Error() . "\n";

# Close it out
$rates->Close();

# Error out of the program
exit;
}
my $now = localtime time;
print "\n$now\n";
undef %id;
$row=1;
while ($rates -> FetchRow())
{
# Clear out for this row
undef %data;

# Get the hash of data
%data = $rates -> DataHash();
$temp_id=$data{"id"};
chomp $temp_id;
# Get our values
$id{$temp_id} = $data{"id"};
$total_num_of_errors{$temp_id} = $data{"total_num_of_errors"};
$meeting_time{$temp_id} = $data{"meeting_time"};
$amount_to_be_inspected{$temp_id} = $data{"amount_to_be_inspected"};
$total_prep_time_hours{$temp_id} = $data{"total_prep_time_hours"};
$amount_actually_inspected{$temp_id} =
$data{"amount_actually_inspected"};
$amount_to_be_inspected{$temp_id} = $data{"amount_to_be_inspected"};
($phase{$temp_id}, $notused{$temp_id}) = split (/:/
,$data{"inspected_item_type"});
$row++;

}
print "\nRetrieved $row records\n";
my $now = localtime time;
print "$now\n";
}

Jul 23 '05 #4
you should try to debug your program then.
adding more print statement to locate where does the error come from.

"Jim" <jf*****@gmail.com> ¦b¶l¥ó
news:11*********************@g47g2000cwa.googlegro ups.com ¤¤¼¶¼g...
Here is the code, it may not be a timeout problem. I am getting about
4200 records out of 80000

sub update_rate_fields
{
$row=1;
# "DB DSN" points to MySQL server and "test_aces_data" DB
$DSN = "DB";

# Make new ODBC object and connect to the server
if (!($rates = new Win32::ODBC($DSN)))
{
print "Error connecting to $DSN\n";
print "Error: " . Win32::ODBC::Error() . "\n";
exit;
}

# Make new ODBC object and connect to the server
if (!($insert_rates = new Win32::ODBC($DSN)))
{
print "Error connecting to $DSN\n";
print "Error: " . Win32::ODBC::Error() . "\n";
exit;
}

# Query to load all data
$reviews_query =
"select
id,
total_num_of_errors,
amount_to_be_inspected,
amount_actually_inspected,
meeting_time,
total_prep_time_hours,
inspected_item_type
from tcgaz_inspections
order by id desc";
# Execute on data
if ($rates -> Sql($reviews_query))
{
# We have an error if we got here
print "SQL failed.\n";
print "Error: " . $rates->Error() . "\n";

# Close it out
$rates->Close();

# Error out of the program
exit;
}
my $now = localtime time;
print "\n$now\n";
undef %id;
$row=1;
while ($rates -> FetchRow())
{
# Clear out for this row
undef %data;

# Get the hash of data
%data = $rates -> DataHash();
$temp_id=$data{"id"};
chomp $temp_id;
# Get our values
$id{$temp_id} = $data{"id"};
$total_num_of_errors{$temp_id} = $data{"total_num_of_errors"};
$meeting_time{$temp_id} = $data{"meeting_time"};
$amount_to_be_inspected{$temp_id} = $data{"amount_to_be_inspected"};
$total_prep_time_hours{$temp_id} = $data{"total_prep_time_hours"};
$amount_actually_inspected{$temp_id} =
$data{"amount_actually_inspected"};
$amount_to_be_inspected{$temp_id} = $data{"amount_to_be_inspected"};
($phase{$temp_id}, $notused{$temp_id}) = split (/:/
,$data{"inspected_item_type"});
$row++;

}
print "\nRetrieved $row records\n";
my $now = localtime time;
print "$now\n";
}

Jul 23 '05 #5
Jim
I found the problem - it was an ODBC bug I believe. I had one of the
fields defined as decimal(5,2) and the value was 362.00. This reached
the limit of that field and caused the Query to stop everytime it hit
that record. Once I change the definition of that field to
decimal(8,2) the problem went away.

I should have been able to work around the problem by having the script
not stop when it hit the error. I commented out the exit and close
lines in the above code but that did not work. Am I missing something?

Thanks for your encouragement Ray.

Jim

Jul 23 '05 #6

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

Similar topics

4
by: Shabam | last post by:
Ok I'm trying to run a php script written by someone else, not me, and it's getting stuck in a particular step. Actually it isn't getting stuck per se, but the browser is, because it's taking...
0
by: Philip Stoev | last post by:
Hi all, Please tell me if any of this makes sense. Any pointers to relevant projects/articles will be much appreciated. Philip Stoev http://www.stoev.org/pivot/manifest.htm ...
0
by: Shabam | last post by:
Ok I'm trying to run a php script written by someone else, not me, and it's getting stuck in a particular step. Actually it isn't getting stuck per se, but the browser is, because it's taking...
2
by: bwana.mpoa | last post by:
Hi, We're using a mySQL database as a replica of another (Sybase) DB for reporting purposes. The Sybase is part of a real-time mission critical system - hence the separate database where people...
2
by: Steven D'Aprano | last post by:
The timeit module is ideal for measuring small code snippets; I want to measure large function objects. Because the timeit module takes the code snippet argument as a string, it is quite handy...
2
by: daniel | last post by:
I have the following scenario. A mysql database running 3 databases. It is version 5.0.27 on Windows XP Prof.. All innodb databases. The one database is particularly large (7.8GB of...
1
by: Charles Crume | last post by:
Hello; I am running the Apache web server, MySQL v4, and PHP on an NT4 server. Apache runs great, but the auction software I am using (Web2035 Auction software written in PHP) is very, very...
1
by: dhanashivam | last post by:
hi, i execute a simple query on mysql database using SQLYog 5.0. the execution time is more on first time (15000 ms) but not on the next times (only 100 ms). help me why? regards, dhana
1
by: cmgmyr | last post by:
Hey All, I'm having a little problem with exporting data from my database. The problem is that the query seems to be too much for PHP and MySQL to handle since it is timing out. I have the timeout...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.