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.





Fine Tune :: Timeout Slow Queries?


I have a very busy database with some tables having hundreds of thousands of records. I am running MySQL 5.0.16 on Windows. Some of the queries running on my database are not fined-tuned enough, and need improvement. However, the system is live in production and I am looking for a way to prevent MYSQL from committing Harakiri, i.e. from running very slow queries forever, taking the cpu to 50% and beyond for hours. My scripting language is PHP. I found that after a while the end user receives a timeout on the browser, but MySQL continues trying to run the query, sometimes for hours.

My question is, is there a way to specify a timeout for MySQL so that it will abort any queries that it is running that have not returned a result by then. The end user is no longer around anyway, so I am looking for a way to protect the database resources (and in parallel I will start investigating how to optimize the slow queries)




View Complete Forum Thread with Replies

Related Forum Messages:
How To Fine-tune WHERE Clause?
I've been doing basic stuff with SQL for a few months now (basic CRUD functionality and apparently I can use LEFT JOIN for everything I need so far).

However, now I need a more fine-tuned query, and I think it needs to happen in the WHERE clause. I could be wrong, but whatever clause it is here's my goal.

I have a table 'staff'. It has columns 'user' (primary key), 'firstname', and 'lastname'. For most rows 'user' is exactly the same as 'lastname'. For the few accounts whose last names differ from the user name, there is a string; otherwise it's left blank.

I'm trying to retrieve a list of employees and order them by last name. However, sometimes the last name is the 'user' column. For the few rows that have characters in the 'lastname' column, this should be factored in.

What's happening now is that when I ORDER BY 'user', sometimes it screws up the ordering of last names. If I ORDER BY 'lastname', then it groups together all the rows that have empty 'lastname' values and then orders as expected for the remainder.

What I want is to ORDER BY 'user', *unless* there is a value stored in 'lastname'. In such a case 'lastname' should stand in for 'user'.

View Replies !
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 !
Too Slow Queries
I am using version 5.0.4. I noticed that suddenly my queries were becoming too slow. I have data in three tables, with 40,000 rows, 50,000 rows and 70,000 rows respectively. I was able to run queries that joined the three tables together and get the results in less than 5 seconds. I tried updating the tables through a program that used a stored procedure to delete the tables but I had some other problems. Since the I restored the data in the tables from backup databases. Now I can't run any queries that join the three tables together, it waits for a long time and then times out. The data in the tables look good. Now I can't get the results from any of the other backup databases either. It look like the entire MySQL server has slowed down greatly. I tried rebooting the server to no avail.

View Replies !
Slow Queries!
I have a website which has a users table in a mySQL database. This users table is large (It has about 25 columns - most varchar(100)) but only has about 10000 records. The records contain user information which is searched with a javascript form.
My problem is that when I click to 'view all', it takes about 7 seconds to load. This seems a lot?
Does 25 cloums seem sxcessive in a table? Can anyone point me to some good tutorials / docs on improving query performance? I have defined the colums as best as I can, but I am using SELECT * from table, would selecting individual columns make a big difference?

View Replies !
What Causes Slow Queries
What causes periodic slow queries? I have checked my slow query logs and for some reason everyonce in awhile, a query thats never slow might be for example, one took 3 seconds to execute and every once in awhile a chat might take 10 seconds of cpu time while rest of the time 0.09...why is it it flexuates so much?

View Replies !
How To Log-slow-queries
I'm running MySQL 5.0.

Now I would like to log-slow-queries. With MySQL 4 I used

mysqld --log-slow-queries --log-long-format start

but now I get following note:

mysqld: Too many arguments (first extra is 'start').
Use --help to get a list of available options

It looks like starting and stopping now only works with

etc/init.d/mysql start

View Replies !
Slow Queries And Optimization
I am hosting a site with an increasing number of members. Letely the site has become slower because of too many queries are being used.
Is there a way of asking the server which queries are used most often, as well as asking which queries take a long time to process so that I would know where to start my optimization process?

View Replies !
Slow View Queries
I have a fairly complex view which, when you execute a SELECT * shows all info very quickly (0.24 seconds to return nearly 3000 rows). However, when I start throwing slightly more complex queries at it, things really slow down - an average query can take 40 seconds to execute.

View Replies !
Enabling -- Log - Slow - Queries
I want to enable --log-slow-queries of MySQL.

How do I do it without restarting the DB server?

View Replies !
Slow Queries With LIMIT
Working with a large table (1 Million Records). Setting up pagination using LIMIT command.

Queries near the end of the table are slow when non-indexed fields are selected (but not included in the 'where' clause).

For example:

With indexes on id (PK), and type:

SELECT id, user_id, name, type, selected, creation_date FROM titans where type = 2 LIMIT 500010,10;
+---------+---------+------------+------+----------+---------------+
| id | user_id | name | type | selected | creation_date |
+---------+---------+------------+------+----------+---------------+
| 1000016 | 100001 | Uni Ekko | 2 | 0 | 1228149051 |
| 1000017 | 100001 | Dynaneedle | 2 | 0 | 1228149074 |
+---------+---------+------------+------+----------+---------------+
2 rows in set (4.17 sec)

If I only search on the ID field, the query is much faster.

mysql> SELECT id FROM titans where type = 2 LIMIT 500010,10; +---------+
| id |
+---------+
| 1000016 |
| 1000017 |
+---------+
2 rows in set (0.36 sec)

explain SELECT id, user_id, name, type, selected, creation_date FROM titans where type = 2 LIMIT 500010,10;
+----+-------------+--------+------+-------------------+---------------+---------+-------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+------+-------------------+---------------+---------+-------+--------+-------------+
| 1 | SIMPLE | titans | ref | avatars_indx2,tst | avatars_indx2 | 2 | const | 381988 | Using where |
+----+-------------+--------+------+-------------------+---------------+---------+-------+--------+-------------+
1 row in set (0.01 sec)

View Replies !
Do Unnecessary Parentheses Slow Queries Down?
I know a person who seriously writes queries like this:

SELECT * FROM my_table WHERE ((((my_col = 30))) AND (((other_col = 40))))

I told him all those parenthesis were unnecessary and he responded that he does it so later if he has to add more criteria the parenthesis will be there. I about fell out of my chair that sounds so ridiculous. So my question is, other than the obvious ugliness and being hard to read, is there any other reasons why NOT to do this?

View Replies !
Optimizing Slow Queries On Millions Of Records
I have a table that has millions of records in it.
About 100 records are added every 5 minutes (one per OIDID) (the sample
provided below has data for 2 OIDIDs (99 and 100)
And I have a webpage that executes 9 queries one after the other, and then
displays the results on the webpage.

When the database was empty, this process was very quick.
But, as the DB grew, it became slower.
Now it takes about 38 seconds for all queries in the example below.
MySQL 4.1 on Windows

I have tried different indexes, and they do help and are used, but the
queries still seem to take a long time. Code:

View Replies !
MySQL Timing Out? Really Slow Queries, Already Indexed.
For whatever reason, MySQL does not seem to be executing. So, I ran a few stat functions and here is what I got:

Uptime: 220372
Threads: 39
Questions: 18748899
Slow queries: 808
Opens: 28723
Flush tables: 1
Open tables: 4096
Queries per second avg: 85.078

The "open tables" worries me for a few reasons. First, because it is 4kb (exactly, since it is divisible by 1024, evenly). This makes me think that maybe I am hitting a ceiling.

Second, there are a few variables in MySQL that equal this, and maybe it's a cap on something. Here are the variables that equal 4096:
query_cache_min_res_unit = 4096
table_cache = 4096
transaction_prealloc_size = 4096

Do any of those have anything to do with this? Am I even close? Are any of those values from mysql_stat a big deal?

View Replies !
Slow Queries, 4 Million Records, Need Educated Advice!
I have created an app a few years back to store some records in a DB.
According our calculations we were never to exceed 500,000 records in
the DB. Seems we were off by a decimal point or so.

I set up a FreeBSD box with MySQL three years back and it has been
filling up. One table has over 4,000,000 records. Yes, four million.

As a web developer and not a DBA, I have struggled to upkeep the server
the best I can. As of the last one million records the server has been
struggling to keep up with multiple requests and as you can imagine the
user base is growing too.

Hardware:
Dual Xeon 3.06 Ghz
4 GB ECC RAM
800GB RAID5 SATA array

Software:
FreeBSD 5.3
Apache 2.0
PHP5
MySQL 5.0.2

Basically I have to perform a search on one of two columns in this huge
table (10 columns, 4 million rows).

The table is MyISAM with a single primary key that is used largely for
updating row data.

Most records are ten digit numbers for one column and a ten digit
varchar for the other, but sometimes either column can be a series of
characters up to 100 chars long, so each column is set for
varchar(100).

The action performed is

SELECT count(*) FROM tableName WHERE col LIKE "%123%"

then...

SELECT * FROM tableName WHERE col LIKE "%123%" LIMIT 0,25

with "%123%" being any random string typed into a search window.

View Replies !
TIMEOUT EXPIRED . TIMEOUT HAS ELAPSED...
I am using MySQL Yog V6.16 GUI. I am also using VS 2005 and .NET Connector 5.2.1

I keep getting "timeout expired. The timeout period elapsed prior to the completion of the operation or the server is not responding".

I use XSD on VS2005 and sometimes stored proc via MySQL.

I have tried connect time out on the appconfig file and even extend the max packets on the myini file.

View Replies !
Tune My Server A Bit
my server consists of a Dual Xenon irwingdale with 4gb of ram running Fedora Core6.

php5.1.6-3.6.fc6
mysql5.0.27-1.fc6

my.cnf looks like this:

# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 64M
max_allowed_packet = 1M
table_cache = 30000
sort_buffer_size = 1M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 128M
max_heap_table_size = 384M
open_files_limit = 65535
long_query_time = 5
tmp_table_size = 384M
max_connections = 150
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

The site is getting about 12000 unique visits per day, with around 100k page views per day. What can I do to speed it up?

View Replies !
Retrieving Data Worked Fine Until One Day . . . .
I have a php site that talks to (or used to talk to) a mySQL database. My Web hosting service made changes (they tell me they are now using mySQL5 but they are no further help) and now my site will not return the data from the database. Instead of data I got the "The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay" error message. I put in the "SET SQL_BIG_SELECTS=1" statement and the error message went away, but now I get a blank page.

I can simplify my SELECT statement (take out the JOINS) and everything works fine, but when I put the JOINS back in I get the blank page.

Here's the SELECT statement that worked fine in the past and now gives me the error message: ....

View Replies !
Fine Tuning InnoDB Database
I feel like a raging bull trying to run a porcelain shop, but I have a question about changing some variables on the server.

I'm trying to insert data into a table, which are several thousand records for each file that I'm reading into the database, only the processing of the data goes painfully slow. The database still runs on it's default settings. Anyone has any advices for changes of the server side variables in order to be able to process the data faster?

View Replies !
SQL Query Works Fine With Phpmyadmin But Gives Me No Results And EOF With ASP
I have a strange problem: when I perform a sql query on my phpmyadmin it works fine and it gives me the right results. If I perform the _same_ query through my asp application I reach immediately the EOF condition without any results!

View Replies !
The Stored Procedure Works Fine, But In The End The Error 'Unknown Table' Appears.
I'm running the Stored Procedure below and it works fine. All register will be transfered to the target table like planned.

But when the SP is finished, the error 'Unknown table REGISTRO_54' appears. That table is a mysqlORARY and none command is executed after the loop.....

View Replies !
Timeout
I am working with program that reads/writes to a mysql database. After 28800 secs of inactivity the connection is lost. Is there a way to set this timeout to unlimited?

View Replies !
Error With SQL Statement When Using MySQL 5.0.24 (Works Fine In MySQL 4.0)
Here is my query that worked in mySQL 4.0 but not in MySQL 5.0.24:

INSERT INTO magtallynew SET magempnum=?', magcentre='YVRRC', entrydate=��-08-15', empnum=?', empcentre='YVRRC', connection='Rockwell', service='Express', region='dom', callertype='CSR', otherdept='', transferredcall='No', directrespdept='No', station='Not Applicable', withoutmagassist='Yes', category='Accounting', issue='Advised On Contact', comments='test'

Here is the error message I get:

#1064 - 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 'connection='Rockwell', service='Express', region='dom', callertype='CSR', otherd' at line 1

View Replies !
4.0.15 Lock Timeout
I'm running the same application on 4.0.1-alpha-win and 4.0.15-win.
Under 4.0.15 I run the same test client as I run against
4.0.1-alpha-win. The behavior is different. In particular, 4.0.15
produces a "Lock wait timeout exceeded; Try restarting transaction"
which does not occur under 4.0.1-alpha-win.

All tables are innoDB.
No "SELECT...FOR UPDATE" is being done.
transaction isolation level is SERIALIZABLE.
Many Selects go through.
The first update hangs, then I get the lock timeout exception.

I don't think the behavior is correct since this code works fine under
4.0.1.

Has anyone else seen unexplained waits on update? If I had done a
SELECT...FOR UPDATE, then I could understand that the wait might be
caused by an uncommitted transaction that performed the SELECT...FOR
UPDATE.

View Replies !
Connection Timeout
I've made a small script in PHP which makes a single connection and then processes a huge list of short strings and sends each to a remote server. The thing is, after some time (8 hours I think) the script just stops and from what I've read it seems mySQL terminates connections made 8 hours ago. How can I fix this?

View Replies !
Timeout Expired
I am in need of some assistance on the VS2005 and MySQL.

I am using C# VS 2005 and SQLYog Community Edition Database v6.16 and MySQL 5.2.1

I am using Winform C#.

I have created XSD with sql text in it. And I get very large data out to be populated in the listview. But I keep getting an error stating:

"Timeout has expired.The timeout period elapsed prior to obtaining ..."

View Replies !
Alter My Timeout Setting
i have a rather long script that makes several connections to a MySQL database. Sometimes , if there is a problem with the script, or a bug in my code, or something else unexpected, the connections dont get closed. Is there a way that i can set MySQL to percieve when a thread has been idle for like 5 minutes and kill it for me? Like a timeout function.
i have googled and searched around here, but i am having trouble finding out just where to do this.

View Replies !
MYSQL ODBC Timeout
I have a simple MS access 2K form to update a MYSQL table. If it sits for about 5 minutes I assume it timesout and reports
a ODBC Call failed then Object invalid no longer set..no current record..
If I close the form and re-open I'm back in business..
Can anyone tell me if there is a registry setting or something to get around this issue

View Replies !
Connection Timeout Message
I keep getting a 2013, after querying mysql I see that my connection timeout is 5.
I think, as a windows user I need to set my connection timeout to 1 year.

View Replies !
Session Timeout Issue
I'm trying to import several million records into MySQL but the darn thing keeps going to timeout before all of the records are imported. How do I change this setting? I'm using the command line and am very confused.

View Replies !
Timeout Transaction InnoDB
I have a application with invoice and invoice_items, but i need
used transaction to save records.

If only user save data this fine. But if two users save data same time, one
users save correctly and another user go to rollback directly,
if second user save data again this ok.

InnodBd Documentation have a timeOut transaction = 50 Secs.
But, the application save all records in about 2 secs.

The sintax is the next: Code:

View Replies !
ODBC Connection Timeout
Hope someone can help me with ODBC connection error I'm having. Have installed mysql 5.0.12 beta-nt and ODBC 3.51.12 on XpPro sp2 machine. I have configured the driver and all works well untill I activate Norton Internet Security. If this is enabled and I use the ODBC configuration tool to test the connection I get the following error;

[MySQL][ODBC 3.51 Driver]Lost connection to MySQL server during query

Windows firewall is turned off and Norton has been configured to allow MySQL. Is the Norton thing a red herring .

View Replies !
Timeout On Remote Server
I've written PHP and MySQL routines to do just that, it all works perfectly in my office on Apache 2.2.9, PHP 5.2.1, MySQL 5.0.37. The code is not that complex.

When I try on the remote server Apache 2.0.51, PHP 4.3.11, MySQL 4.1.20 it sometimes works, sometimes fails.

We have well over 2000 products. Usually if I atmysqlt to insert or update 2220 products or so all is well. Add another 12 products and it fails. But sometimes it doesn't get even past displaying the MySQL version number at the top! It doesn't even get to the point of updating prices.

I've been trying to optimize and speed up my code, I changed some code so tables are now read into arrays rather than repeatedly accessing the database. Speeds things up a bit here but remotely it still fails in exactly the same manner as before.

I don't have access to the remote server MySQL or PHP settings. Here in the office I can reduce timeout settings until I get errors, but I always get an error message.

On the remote server I never get an error message, it just stops. Persistent connection makes no difference. The time from start to failure varies from a few seconds to as much as several minutes.

If I enter 8000 products here in the office, that too works fine, although it takes awhile.

View Replies !
UNION, Individually Works Fine, But Not In Union
Well, I am using an UNION, and while both of the queries works fine while used individually, they don't work while in the UNION.

Here is the code -

PHP

(
SELECT *
FROM job
WHERE date_fin !=0000-00-00
ORDER BY date_fin ASC
)
UNION (
SELECT *
FROM job
WHERE date_fin =0000-00-00
ORDER BY date_creation ASC
)

What do u think guys?

Note : MySQL version 4.1.21

Note : Not working means, this part is not working => 'ORDER BY date_fin ASC', means, the returned results are not ordered as I want.

MySQL doc. tells,

To apply ORDER BY or LIMIT to an individual SELECT, place
the clause inside the parentheses that enclose the SELECT:

(SELECT a FROM t1 WHERE a=10 AND B=1 ORDER BY a LIMIT 10)
UNION
(SELECT a FROM t2 WHERE a=11 AND B=2 ORDER BY a LIMIT 10);

View Replies !
Timeout Problem (windows Client)
I'm developping with php/mysql a web application for database managing and my problem is the following :

When I navigate throught my pages everything is ok but if I'd been inactive for a couple of minutes and I can't navigate anymore and my browser (IE and firefox have been used for this test) inform me that there's no databases selected. I use sessions in my web application and I thought it could end but I check my parameter and the time session is infinite.

Do you think the problem come from default timeout?, how do I change its value ? (I work with easyPHP (Apache 1.3.33, PHP 4.3.10, mysql 4.1.9 )

View Replies !
Apply Query Timeout In Mysql
I have to apply Query Timeout in Mysql.I wants that whenever Query take more than 10sec an exception will be thrown from mysql side.Is It possible in Mysql?

If possible how can I do it?

View Replies !
Error Connecting: Timeout Expired
discovering an issue with creating connections when my db encounters serious load. The exact error that I'm seeing is: "error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached."

should note that this particular app works well in most normal scenarios, and we only see this problem when there are many threads hitting the database for longer than a few minutes. Roughly once an hour we encounter serious load like this.

Here's what I see under 'show variables':
Variable_nameValue
auto_increment_increment1
auto_increment_offset1
autocommitON
automatic_sp_privilegesON
back_log50
basedirD:MySQLMySQL Server 5.1
big_tablesOFF
binlog_cache_size32768
binlog_formatSTATEMENT
bulk_insert_buffer_size8388608
character_set_clientlatin1
character_set_connectionlatin1
character_set_databaselatin1
character_set_filesystembinary
character_set_resultslatin1
character_set_serverlatin1
character_set_systemutf8
character_sets_dirD:MySQLMySQL Server 5.1sharecharsets
collation_connectionlatin1_swedish_ci
collation_databaselatin1_swedish_ci
collation_serverlatin1_swedish_ci
completion_type0
concurrent_insert1
connect_timeout10...............

View Replies !
Lock Wait Timeout Exceeded
I am getting this error when updating a row. I am using mysql 5.0.16nt version.

mysql> update my_sys_seq_no set curr_val=10 where key_col_nm='role_id';
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

View Replies !
Subquery Error Causing Timeout
I'm going to pose a general question (first) rather than post my query:
I have this query which normally runs fine but yesterday just ran on and on. It ended up timing out 8 hours later (the default, it seems - but I will change that)
When I EXPLAIN the query it tells me that a subquery returns more than 1 row. Which is fine and I have amended the query. But in that case shouldn't the query have failed, rather than running for 8 hours?
Oh, and why would the query show as sleeping in SHOW PROCESSLIST?

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 !
Occasional Apache Timeout When Using Mysql, Windows
I have the most up to date versions of apache, php and mysql on my windows machine. Sometimes, when I run php scripts that use mysql I get an apache timeout. This happens only occasionally, not at any specific circumstances I can re-create. There is no mysql or php error, but it happens ONLY with scripts that use mysql.

View Replies !
Lock Wait Timeout Exceeded; Try Restarting Transaction
I have a simple query fired on click of a button.

i.e., update table_name set column1='20' , column2='15' where id='1';

Even through the query browser it is giving

Lock wait timeout exceeded; try restarting transaction ,this exception.

The same was working a couple of days before.

what might be the reason for this exception.

View Replies !
Error On Insert: Lock Wait Timeout Exceeded
I've got 6 Java client applications (running on 6 different PC's, including one of them on the database server) reading data from a flat file and inserting data into a table on my database:

[root@appserver2 mysql]# mysqld -V
mysqld Ver 5.1.12-beta-log for unknown-linux-gnu on x86_64 (MySQL Community Server (GPL))

There are total about 12 million lines of data to read from these flat files and INSERT into a Innodb table on the database. Each client application has 20 threads running which run some validation code on the record and then perform the insert. I have not exceeded my max_connections.

Around insert number 450,000 all of the clients started getting the following error:

Exception in Processor.DataArchiveInsert, trying to insert into data_archve, e:
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

and also:

Processor.ProcessData(), error inserting claim : java.sql.SQLException: Lock wai
t timeout exceeded; try restarting transaction

The java code for Processor.DataARchiveInsert is: Code:

View Replies !
Lock Wait Timeout Execeeded: Try Restarting The Transaction
I am using MySQL 5.1.23 and Jboss 4.2.2. My application is trying to update a ta ble. But it is waiting for the lock on the table for more than 200 seconds. I can see that in the processlist table. After that jboss throws CannotAcquireLock Exeception saying timeout exceedded; try restarting the transaction.

I have a dedicated schema where no one connected to that schema or querying on that table. Transaction timeout is set to 5 mts in my jboss-service.xml. Anyone knows what is wrong here?

View Replies !
Lock Wait Timeout Exceeded How To Find The Source ?
I am running an application using Innodb. My application is based on transaction concepts. So sometimes I do get this error of "lock wait timeout exceeded" ? I know this is due to some deadlock. But how and where can I analyse to see what is the cause to my this locking problem and how can I overcome this ? Thanks.

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 !
Error : Lock Wait Timeout Exceeded; Try Restarting Transaction
i am trying to create a java application using mysql but if i try to create multiple connections, i keep on getting this exception given below. I have read about the TransactionDeadLockDetectionTimeOut option but i am neither able to find config.ini nor i am running the cluster for which this option applies. Code:

View Replies !
MySQL 4.0.18 On Dual AMD64 Opteron Causing Thread Zombie Even When Timeout Is Set To 60 Seconds
We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10
for a very high volume site. We are evaluating the performance on our
new server AMD64 and it seems it's slow compared to Dual Xeon/MySQL
4.0.15/RedHat8 and Dual Xeon/MySQL 4.0.18/Mandrake 10.

And it seems there are zombie threads. 570 threads in 1 hour and we
didn't even use JDBC connection pooling at all. These threads are
supposed to be gone within 60 seconds, since we set that option in
mysqld. Note that we run many SELECT queries (can be up to 150
queries/seconds), but the system does not indicate any slow query:
it's 0!

Our configuration is Apache 2.0.48 + Tomcat 5.0.27 + MySQL 4.0.18 with
MySQL connector/J 3.0.14 (latest stable). The Redhat 8 runs on Apache
2 + Tomcat 4.0 + MySQL 4.0.15. The old Redhat 8 on Xeon was fine. We
have another machine running Mandrake 10 on Xeon and they were fine
under the same load.

I have set the wait_timeout to 60 seconds, and it appears to be fine
within 10 minutes, all the threads that are in "sleep" mode
disappeared after 60 seconds. After a few minutes though, it's back
like it was before.

Is this Mandrake problem? MySQL problem? I read in here than Mandrake
win hands down on AMD64 compared to FreeBSD. Code:

View Replies !
Lock Wait Timeout Exceeded; Try Restarting Transaction Even In Single Db Single User
I am updating few databases all which I keep as one transaction using .net connector. The best part is that I can still run into this error of "Lock wait timeout exceeded; try restarting transaction" even though I am the only single soul using my database at that time. Any idea how to over come this problem.

View Replies !
Is There A Mysql "timeout" Function?
Is there a mysql "timeout" function? For example I run a select query from a php script that would normally take 30 seconds. With the timeout trick (In the query to mysql I suppose), mysql would return some stuff (efter let's say 5 sec) saying that the query was too long.

View Replies !
Slow
What generally would be the reason why all my db driven sites are running slowly or even hanging. I am on braodband speed but just changed hosts.

View Replies !

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