Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Printing Debugging Info Into A File During Script Execution


I've got a very large script (~50GB) that takes a very long time to execute. I want to echo text into a output file at various places during the execution. Something like:

...
select 'message 1';
...
select 'message 2';
...

If the script is: doit.sql, then I just do:

mysql -uUSER -pPASS < doit.sql > log.out

The problem is that I can't see the information in log.out because STDOUT is not flushed until the buffer is full. So, I thought I'd do something like:

select 'message 1' into outfile 'log.out';

Unfortunately, mysql doesn't append to log.out.

So, how can I get logging information into the log.out file so that I can let the script run in the background and just do something like:

tail log.out

to see the most recent messages and know that they are not being kept in some buffer pending output. This script takes about 2-3 days to complete and I want some method of seeing what things the script has done. The messages I have in the sql script make it very easy for me to know just what has been done, but don't do me any good if they're in some darned STDOUT buffer.




View Complete Forum Thread with Replies

Related Forum Messages:
Upload Mp3 File And Info Into Database
I decided to create a directory on my server to store the mp3 files instead and then to store the files path in the mysql

so I would first create the table like this


$sql = CREATE TABLE mp3_files (
id int NOT NULL AUTO_INCREMENT Primary Key,
Song Name VARCHAR,
Artist Artist VARCHAR ,
Release_Date date,
Additional Notes VARCHAR,
Path ?? );


where "Path" would it me VARCHAR type?? and how would I store the absolute path of the file using PHP

Lets say I had a folder called MP3_Files on my server that would contain all my mp3 files and I uploaded an mp3 song called big poppa? How would I store this location so that when

View Replies !
Inserting Info From A Text File Into A New MySQL DB
I just installed Mambo on my server. I recently had to change servers due to money constraints and I saved my entire DB of content, categories, users, etc. into a SQL file...but when I click the "Insert data from a textfile into table" link and upload the file into different tables, it appears as if it makes no difference. Can somebody help me out? If you respond or send me a pm I can send you the file for you to look at, and maybe you can identify the problem for me. I really appreciate any responses to this issue. I am trying to get the data the exact way it was on my old site without manually putting it all in via the administration backend.

View Replies !
Debugging
I've blocked my password for my protection

$location = "66.54.137.32";
$username = "peelesd";
$password = "*******";
$database = "db1";

$conn = mysql_connect("$location","$username","$password");
if (!$conn) die ("Could not connect MySQL");
mysql_select_db($database,$conn) or die ("Could not open database");

View Replies !
Debugging Stored Procedures
Does there exist any debugger for the stored procedures in MySQL 5? If not is there some documentation of how debugging tips in general?

View Replies !
Debugging Mysql Stored Procedures
I serfed web to find some kind of mysql stored procedure
debugger. But I found nothing.
Last week at last a tool with integrated debugger was released.
It uses debug engine.

like an oracle dbms_debug, and supports breakpoints, watches, call
stack, and stepping through code facilities. May be it can help you
developing complex stored routines.

View Replies !
Printing From Mysql
How do I print the results from mysql queries? I have searched the manual and can find no references to printing commands.

View Replies !
Duplicate Entries And Printing
Say I run a query from a table in my DB.
The numbers that are pulled with a query are as follows:
1,2,2,2,3,4,5,5,
How can I just ignore the multiple instances of the 2 and 5?
I want it to print 1,2,3,4,5

View Replies !
Printing Out Tables Without Fields Name
I am using the command:

select address,goto from alias where active=1;

to get a list of e-mail redirections such as:

address goto
job1@example.com user1@domain.tld,user2@domain.tld
job2@example.com usere54@domain2.tld,sfjh@domain32.tld,...
...

Is there a way to get rid of the names of the fields (address and goto), so that the output would only contain the data?

View Replies !
Printing Mailing Labels
how do you print mailing labels from a mysql database?

View Replies !
The Art Of Printing Mysql Columns
there are many ways to make this happend but what is the best way
of printing mysql records from one column in non divided number of columns-say 5 columns?

say you got 10,000 names and you want to print it in 5 columns,

that is a very poor drawing of 12 records in 5 columns:
1 2 3 4 5
6 7 8 9 10
11 12
...every one of this 12 is a name

printing a name + checking if is there some ditails reffered to this name in other table column...:D

View Replies !
Printing A Database Structure
Does anyone know of a method to print every tables sructure using "DESCRIBE tb_name" without doing it table by table...?

I would like to do this but there are about 50 tables and it would be a waste of time if I "DESCRIBE tb_name" for 50 tables and then still have to click on "Print View"... and then still click "File|Print" in the browser.

I am sure there is a quick method of preparing a data dictionary. I have done it before but I cant remember how!?

View Replies !
Printing All Rows Starting At A Specfic Row
Basically what I want to do is grab the ALL data in my table starting from a certain row.

So i have 100 rows, I don't want to print the first 15, but i want to print everything after row 15. But saying that, the rows will change, and because of that I don't think a LIMIT function is needed? (ASC LIMIT 16,100)

EDIT:

Problem solved, a simple:
SELECT g_id, g_title FROM games WHERE g_id > 15

View Replies !
Printing Table From Mysql To Lpd On Linux Box
a php script was run and got my result. I would like to just dump that same info to my IP printer. No fancy fonts required just text. Mysql is for intranet purposes only.

View Replies !
Printing A Result After An Option Has Been Submitted
My goal is this.- To print another field value 'scriptcode', of the same row after an option 'scriptnaam' is submitted.

The first part isn't the problem. I do get all the data 'scriptnaam' in a select field.
But to distillate, a result 'scriptcode' out of it ???

If someone could help me a bit further with that, that would be great.
I like to mention, that I've just started with PHP/MYSQL, so my knowledge about it is limited. Code:

View Replies !
Printing The Mysql Database Variable Names
Currently im using the code below to print the database values in a table. But what this doesnt show is the variable names (ie. column names).

Anybody know a way I can do this?

print "<table border=1>
";
while ($get_info = mysql_fetch_row($result)){
print "<tr>
";
foreach ($get_info as $field)
print " <td><font face=arial size=1/>$field</font></td>
";

print "</tr>
";
}
print "</table>
";

View Replies !
Ending Of Execution
is it important to free resources and end connection after every code execution...
i found a few codes examples and they don't usually end with DIE or EXIT... so i'm curious if thats a security risk?

View Replies !
Execution Performance
Just out of curiosity, does adding LIMIT 1 to the end of single row UPDATE queries improve execution speed at all?

View Replies !
Execution Time
After we execute a statement in mysql, it reports the query execution time in the format: n rows in set (t sec).

We may do something like this to get the execution time:
$time_start = getmicrotime();
mysql_query( "" );
$time_end = getmicrotime();
$time = $time_end - $time_start;

But it includes extra CPU time to run two getmicrotime() functions and one subtraction.

Is there any way to obtain the execution time directly from mysql without running extra functions or calculations?

View Replies !
Log Execution Queries
I am writing a program in python, and I use mySql v1.2.12, I wanna know If mysql logs any command such as wxecution commands(like INSERT, UPDATE, DELETE), if yes how can i access them?
thanks all

View Replies !
Automation Of SQL Execution
I am looking for a tool or process to queue up many sql requests and automatically execute and deliver back via email - to enable around the clock processing.

View Replies !
Asynchronous Execution
I have the following situation

php file 1: an SQL writes data to the database
php file 2: an SQL reads data from the database

Some users report errors that MIGHT be due to the SQL in file 1 not being executed, before they click on a link to open file 2. So they get out of date information.

I want to know if this is technically possible, whether this might indeed be the problem, that if a database is very busy, that SQL statements are queued and data retrieval may read obsolete out of date information, because the data storage SQL has not been executed yet.

And if this is the problem, I would like to wait in file 1 until the data has actually been written.

View Replies !
Mysql WHERE Condition Execution
I have 2 columns and I search rows with two conditions.

SELECT * FROM table WHERE A = '$a' AND B = '$b'

How can I make mysql search columns with A condition first and after
that within these condition B.

I would like to know, how mysql search works.
How can I tell mysql how to search?

View Replies !
Query Execution Time
I m using inner join where there is no keys (Primary and foreign). I want to know that Does key affects execution times?

View Replies !
How To Get Time Execution Of A Query?
Do you know how to get the time that a query executes? Is there a formula on how to get it?

Example:

Note: I have 5000 data in the table cars

$result = mysql_query("Select * from cars");

Question: How to get time of executing the query above?

View Replies !
Improve The Execution Time
i am new to db2 want to ask questions about the performance of my sql commands for a view based another 3 views

the sql commnads are as following:

create view b_central_subgroup as
select communicator as central_member, project_id as project_id
from b_normalized_communicator
intersect
select initiator as central_member, project_id as project_id
from b_normalized_initiator
intersect
select monospeaker as central_member, project_id as project_id
from b_normalized_monospeaker

it takes 4.4 seconds to execute this sql.

it likes that the time is the summ of the other three views.

Can the execution time be reduced through some other methods?
If it is possible , then how ?

View Replies !
How To Get Query Execution Time
How to get query execution time in "mysqlquery.log" files

I am using:

Linux 7.3
mysql 4.1

How to display the query execution time for each and every query in log files.
i have configured "slow-log-query" and "mysqlquery.log" in "my.cnf" is pasted below.

log = /var/lib/mysql/mysqlquery.log
log-slow-queries = /var/lib/mysql/slowquery.log
long-query-time = 0
slow-launch-time = 1

then i can get a output in "mysqlquery.log" like,

070830 9:24:29 2 Connect root@localhost on
2 Init DB jbdatabase
2 Query select count(*) from vacancy1_table
2 Query select category,listcategory from category_t
able order by category
2 Quit


but i need to display the "timetaken of each end every executed query" along with the query in the above logfile like,

E.g:select category,listcategory from category_table order by category(0.03 secs).

View Replies !
Query Execution Status
How can we know that , the last executed query status like executed successfully or not.

View Replies !
Query Execution Too Slow!
I have migrated from MySQL 4.1.22 to MySQL 5.0.45. Many of the queries that were working on my old server is working too slow in my new server(MySQL version 5.0.45).

I am not aware why is this happening. Actually there is no error message or query failing. The query is executing, but the time taking to execute the query is too long. This problem is not occurring for all queirs, but only for some complex queires, that is queries with Left Join or Right Join, Group By etc.

I have also checked the MySQL details through SSH(that is by mysql> SHOW VARIABLES;)

Now one thing I found is there is lot of difference in key_buffer_size, table_cache, join_buffer_size, read_buffer_size, read_rnd_buffer_size , table_cache etc between my new server MySQL and old server MySQL.

Will this be the reason for query execution taking too much time.

Can any one guide me why this is happening. The striking thing is that these quires was working very much fine and faster in my old server.

View Replies !
How To Get A Query Execution Time?
How to get a query execution time?

View Replies !
Measure Execution Time
I would like to measure the execution time of my queries in order to evalutate the performance in/decrease for different changes. Even if I use 'sql_no_cache' the query executes MUCH faster the second time I run it, and is therefore not representative of the true performance. How to I avoid this problem?

I'm using MySQL 4.1 on a windows server 2000. I be glad to get an explanation to why the query executes faster the 2nd time.

View Replies !
Last Query Execution Time
Is there a way to retreive the elapsed time for the prevously executed query?

Alternatively, Is there a way to query the current time in fractions of a second?

I am attempting to use a stored procedure to execute and track the time it takes to run some queries and other commands.

The logic of the stored proc would go something like this.....

View Replies !
Mysql Execution Sequence
I need to retrieve the last value from a column in a mysql table, perform some actions on it, then add 1 to the original value and store a new entry.

I am worried that if multiple users access the database at the same time I will end up with duplicated 'new values'. Does mysql complete execution of a script before it allows access to another user or do I need to 'lock' the table in some way while the script executes?

View Replies !
Query Log With Execution Time?
I have developed a big property portal web site and have probably written about 1000 different SQL queries in the process (OK, maybe only 500 or so) but a lot.

The site is now gaining popularity and although it is on a dedicated server I want to make sure that everything is running smoothly. I have optimised several tables with indexes etc. and have sped up certain tasks, but would like to know if there are any other queries that take too long and should be optimised.

Is there a way to log all queries together with the time it took to execute the query? Is this already logged and if so - where is it?

View Replies !
Slow Query Execution
Right now I am fazing one issue which is getting hell out of me. I am explaining the issues step by step.

1.I have one site running from last 3 years with large database and there is one main table which has maximum load.

2.Now, I have redesigned the site with lots of changes within this table too.

3.The problem is that the server is same, queries are same but output in the new database is taking 50 times more execution time.

4.I also just copy paste the table, and fire the same query... Strange even that is not working...

Is it something where newly added table or database is having issues in the server?

I have tried all, compared the structures of the data and table but still the query result is too slow on live testing sever. While same query in main site of same server is running perfectly.

View Replies !
Execution Time Of Queries
Approximately how much time would it take to execute a 3 column fulltext table with one million (plus) rows?

View Replies !
Copying Table To Disk During Execution
I seem to be having an issue with a query's results being paged out to
disk during runtime. I notice in processlist it saying "Copying to tmp
table on disk".

select col1, col2, count(ip) as 'COUNT' from db.table group by 2 order
by 1, 3;

None of the columns are a primary/foreign or an index. This query
returns 92K rows and has taken anywhere from 50 seconds to run to over
1.5 minutes. The table size on disk is around 33MB.

After doing some research i found that i should be changing the
tmp_table_size system variable. Originally it was set to the MySQL
default, 33554432. I set the varaible to 90,000,000 and it still
started paging out to the disk (this was the only query running at the
time). I would think that 90MB in space would have been enough to
handle the query since that would assume over 600K row size.

I actually had some trouble setting the tmp_table_size for the global
variable but was able to change it as a session variable.

I have also tried altering the query_cache variable (which has only
slowed the query down - currently it sits at a size of 50MB) and also
the sort_buffer_size but neither have made a difference.

What is the magic variable that i should be messing with?

View Replies !
Query Execution Time In PHP Script
I am interested in displaying the query execution time as mysql does from the console, but using php. I've looked everywhere for this and can't find anything. Does anyone know how to display this information to the browser via php? The information must be there since the console provides it.

I checked the php function mysql_info(), but that only shows records, duplicates, deleted, matches, changed, warnings, etc. Didnt see any specific php function for getting execution time.

View Replies !
Report Of Query Execution Times
Does mysql have a tool to record and report a list of all queries executed and how long it took to execute each query? If not can anyone suggest a tool I can use to do this?

I've heard of mysql query profiler but does it capture queries from all sessions?

View Replies !
Query Execution Time & Mysql_stat
I am using mysql for my shopping site,Performance of site very slow then I used mysql_stat php function to find out how many slow queries,it shows 20.

Now my question is any function in mysql(or)PHP to show 20 slow queries.

View Replies !
Database Size And Max Execution Time
I have now got a large database that is getting to a size of about 4Mb when downloaded (dumped / uncompressed).On my Web server everything seems fine. But when using said database on my home server (localhost) I am recieving Max Execution time of 30 second errors constantly.How can I stop this from happening and is it likely to start happening on my web server soon?

View Replies !
Query Total Execution Time
How to get total time taken by a query to execute....

View Replies !
Mysql Shuts Down During Rapid Execution Of Querys
I am using version 4.0.12-nt of MySQL and when I hit the enter key
rapidly I can't connect to the database. The result is a message is
returned to me from mysql that says I can't connect because the
database is down. If I only hit the 'enter' key once (to execute the
page that my queries are on(their are four queries on this particular
web page)) my queries execute just fine.

We have noticed that this only happens when we:

View Replies !
Fields In The SELECT Affecting Execution Plan
Is it possible that fields in the part of the SELECT affecting performance?

e.g:

select * from a where employee>10 (run very fast)

select id from a where employee>10 (run very slowly).

View Replies !
Measure Execution Time Of Mysql Script
I am trying to measure the total execution time of a mysql script that I run using the mysql command line client in batch mode (-e "source myscript"). The --tee option does not work for the batch mode so that I could then gather and add up the execution times of the SQL queries as logged by the server.

Adding a tee command in the script itself is not working. Using the time command (in Linux , and timex is not available) on the mysql program is also not helpful as I think it does not include the execution time of the queries on the mysql server side, but only the system and user times corresponding to the client process.

View Replies !
Slow Query Execution With Strange Issue
Right now I am fazing one issue which is getting hell out of me. I am explaining the issues step by step.

1.I have one site running from last 3 years with large database and there is one main table which has maximum load.

2.Now, I have redesigned the site with lots of changes within this table too.

3.the problem is that the server is same, queries are same but output in the new database is taking 50 times more time.

I have tried all, compared the structures of the data and table but still the query result is too slow on live testing sever. While same query in main site of same server is running perfectly.

Have any one fazed such and issue? Please help me out of the situation as site is ready but I m not able to put new version live.

View Replies !
Force Execution :: Ignore Duplicate Entry
how do i execute an 'insert into...select' by force? meaning, it ignore 'duplicate entry' errors.

note: i am using mysql 4.1.9.

View Replies !
Fatal Error Encountered During Command Execution
i wrote the following line of code but whenever i execute, i get an error message "Fatal error encountered during command execution" .....

View Replies !
Check Query For Syntax Prior To Execution
I was wondering if it was at all possible to check an SQL query prior to execution for syntax errors?

A method which wouldn't alter the data to which the SQL statement related to.

I'm guessing you could perform a transaction of sorts, but is there another way?

View Replies !
Slow Execution For A Left Outer Join Query
Whats likely to be the cause of slow execution for a left outer join query?

The original query joins three tables but even if I narrow it down to one it still takes a long time to execute.

$query = "select distinct materials.* from materials";
$query .= " left outer join materials_products on materials.material_id = materials_products.material_id";

There's 914 rows in the materials table and 1348 row in the materials_products table

Is it likely to take a long time for this amount of data or is there likely to be a problem in the table(s) set up or query?

View Replies !
Can't Connect To MySQL Server On 'localhost' (10061) On Script Execution
Whenever I run this script:

<?php
$mysqli = mysqli_connect("localhost", "root", "rootnow");

if (mysqli_connect_errno()) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
} else {
printf("Host information: %s
", mysqli_get_host_info($mysqli));
mysqli_close($mysqli);
}
?>


I get this error message:
Connect failed: Can't connect to MySQL server on 'localhost' (10061)

I'm running Apache 2.0.58 with PHP 5.1.4 and MySQL 5.0.20 on Windows XP Home Edition.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved