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 Complete Forum Thread with Replies
Related Forum Messages:
Slow Queries When Using Views Compare To Direct Table Queries
I’ve having problems with my server load for a while now. I have two tables with different content, but I need to display them in the same results, so I created a view with a union all (named: top_news_videos). The problem that I’m seeing is that when running a select to the view it takes a lot longer (and in that way, more server intensive) than running the query directly to one of the tables. For example, I created a page where I run 7 queries similar to this one: MySQL Code: ...
View Replies !
Complex Queries Versus Multiple Simple Queries
I am constructing a database to contain information about stories posted on my site. Information included will be things like title, author(s), genre(s), story codes, synopsis, etc. I worked out that storing this information properly, so that it can all be searched on, could take as many as ten tables. My question is this: Is a single complex query really better (more efficient for the server) than multiple simple queries? In other words, I may need the information for as many as 25 or even 50 stories for a single page. Is it better to get all of the information out of a single, massive, complex query, or is it acceptable to get the information essentially one story at a time, which could mean 25 or 50 simple queries...?
View Replies !
Many Smaller Queries Vs. Large Comlicated Queries
I am wondering if any one can help me. I have a page that will run around 85 smaller queries but if i combine the queries it will go down by almost half. This page is a high traffic page and I don't a complicated query taking up mysql resources while it created a temp table and such. My question is this: Is it better for mysql to run a lot of smaller queries (ex: simple selects with zero or one join, group by) or one larger complicated query with everything combined. The thing i have to keep in mind is that the mysql selects are comming off the localhost that the web server is also running on so they share the same resources.
View Replies !
Long Queries VS Multiple Short Queries
I have a php script that requests a very long query from our mysql database. It has lots of joins and accesses at least 5-6 tables. My question is should i break it up into smaller separate queries or leave it as one long one, in regards to best practices?
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 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 !
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 !
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 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 !
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 !
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 !
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 !
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 !
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 !
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 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 !
Maximum Execution Time Of 300 Seconds Exceeded (was "MYSQL Error")
I have a huge database 400mb+ in size which i have exported into a .sql file. I tried to run this export script into a new database and it runs fine until three quarters into the scripts execution and the following error appears: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<br / > <b>Fatal error</b>: Maximum execution time of 300 seconds exceeded in <b' at li ne 1 I believe this error may relate to "delayed_insert_timeout = 300". How do I increase this limit in mysql - maybe it may solve the problem but then again it may not . Any advice is most gratefully appreciated - As you can imagine if the script runs fine for 3/4 of it and then an error appears, stating the error is on line 1, it will take me days to go through the whole script (hundreds of thousands of rows) to find the error as I assume the error does not reside on line 1 as this line would have been executed. I am running the script on mysql 5, and via source /path/****.sql on linux.
View Replies !
How To Put These Two Queries Together?
Howto put these two queries together? sql = "SELECT DISTINCT medium_id, COUNT(tag) AS count FROM tags WHERE tag = 'test' GROUP BY medium_id ORDER BY count DESC" This query is working. Id like to try something like: sql = "SELECT * FROM media WHERE id IN (SELECT DISTINCT medium_id FROM tags WHERE tag = 'test')" But how can I order the resut by quantity (counts of tag)?
View Replies !
1 Or 2 Queries
I have an established schema of databases and tables. A requested feature came up, that would allow for a user to add an item to the database, and not have it display on the website. Would it be better for the site to run a query along the line of SELECT * FROM db.table WHERE item=item AND view='yes' or Get the data then run a query against a separate table to see if the part is in the not viewable database
View Replies !
2 Queries
it won't run both queries and unite them - it's ignoring 'where approved='yes')? : Code: $sql = "SELECT CONCAT(firstname , ' ' ,lastname) AS FullName, username, homepage FROM customer WHERE approved='yes' AND lastname LIKE 't%' OR username LIKE 't%' ORDER BY lastname ASC";
View Replies !
WHERE (xyz OR Abc) Queries?
I'm just wondering if it's possible to include some sort of "OR" type condition in MySQL queries? I'm assuming it can be done, but I can't seem to find anything, and of course typing MYSQL +"OR" into a search engine doesn't bring the most specific of answers.
View Replies !
2 SQL Queries
2 questions I'm hoping someone will be kind enough to help me with: Firstly, is it possible to do something like: SELECT * FROM (SELECT `table_name` FROM `table_list` WHERE `type` = 4 LIMIT 1); I'm trying to select the table name to use by querying another table. Secondly, I'm trying to use variables to tidy up another query: SELECT @r := TRIM(TRAILING '_' FROM `long_room`) AS 'Room' ... WHERE @r LIKE 'WL214'; Am I using variables in the right way? This doesn't return anything and using "'Room' LIKE 'WL214'" doesn't work. I know I can use the whole Trim statement in the Where clause, but I want a tidier way of doing it.
View Replies !
Max Queries
Using JDBC and a connection pool, MySQL 5.0 on Debian Sarge, does anyone have any prior knowledge or a suggestion - should I limit the number of queries per connection? If so - to what number? (I've already got a maximum time to live for a connection, so at any case I'm not going to reuse a connection forever). Is using and reusing a connection memory-consuming, tending to grow over time?
View Replies !
Best GUI For Queries
I currently use myqlcc instead of query browser, but have been looking for a replacement that might combine some of the best features of both (plus one still being updated). I use the prog for writing and running queries, not so much for administering the db. I don't hear a lot written about them, but these are what I consider to be the best features of mysqlcc, which I can't find replicated in other progs. Can anyone recommend a GUI that has at least some of them? --Table/field highlighting (recognizes real db data and highlights it when entered) --Autocomplete (shows me possible matches from partial entries with a keystroke) --Parentheses highlighting (lets me see what is in a given start/end parenthesis) --update/delete results messages (shows xx rows matched, yy rows affected) --Tabbed multi-threading (of course) --Ability to grab all/some results and copy to the clipboard for export to Excel (not all have this) Anytime I try to google favored applications, I come up with Navicat, which seems to have the budget to buy search results; doesn't make it a good program (does anyone like it?).
View Replies !
Queries Per Second: 135.73
According to Runtime Information: Queries per second: 135.73 Is this an acceptable value, or is this a sign that something is probably wrong? The site gets about 300k page views per day.
View Replies !
|