473,388 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Need help with optimizing / speeding up large MySQL MyISAM tables

Hi,

I'm somewhat new to MySql. I've been using it for a while, but pretty much
out of the box setup, and am starting to suffer heavily with my larger
tables. I have a table with 5,000,000+ rows that I have to search and do
joins on. Although I have an index set up for it, the joined select will
still take some 400+ seconds to return, which is obviously unacceptable.
This is due to enormous HD access.

Perhaps someone can help me with indexes here; I was under
the impression that the index for the tables are cached in memory, and
therefore permitted "instant" searchability, without having to retrieve data
from each of the rows of the DB. Is there a startup parameter, or
something in the mysql.ini file, that must be set to allow for this? I have
the index configured properly, and have made sure that the query uses there
parameters in the where clause in the same order that they appear in the
index.

I've tried to do an explain on the select statement and I get the following:
table: record
type: ALL
possible_keys: PRIMARY
key: (NULL)
key_len: (NULL)
ref: (NULL)
rows: 50644
Extra: Using temporary; Using filesort

table: table0
type: ref
possible_keys:
recordid,recordid_idxfield_idxvalue,Fixed_fields_o nly,Fixed_fields_and_gener
ic_fields
key: Fixed_fields_only
key_len: 20
ref: record.recordid
rows: 114
Extra: Using where; Using index
My select statement is as follows:
SELECT record.* FROM record as record, index2 as table0 WHERE
(record.recordid = table0.recordid) AND ( ( ( table0.recordid IS NULL OR
table0.recordid IS NOT NULL ) ) and ( ( table0.transid IS NULL OR
table0.transid IS NOT NULL ) ) and ( table0.formid = '4' ) and ( (
table0.clientid IS NULL OR table0.clientid IS NOT NULL ) ) and (
table0.active_recordid IS NULL ) and ( CAST( table0.issaved AS SIGNED) =
1.0 ) and ( ( table0.isclosed IS NULL OR table0.isclosed IS NOT NULL ) ) and
( CAST( table0.isdeleted AS SIGNED) = 0.0 ) ) ORDER BY table0.recordid ;
As you can see, the only reference I am making to table record is to the
field record.recordid, which is defined as my primary key for the table. So
by definition, there is already the primary key index for that table. I
don't understand why it is listing (NULL) for the key that it is using.
I've already tried running an "analyze" on both tables. All the "IS NULL or
IS NOT NULL" is to ensure that the field is being searched to match the
field ordering in the index. Is this redundant?

Additionally, is there anything else I can do to speed up my queries /
indexing and reduce the amount of disk access?

Is there a way of forcing/requesting mysql to cache entire tables in memory?
Can one specify which tables to cache in memory?

Thanks for any insight,

Eric
Jul 19 '05 #1
0 1858

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

Similar topics

5
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
0
by: Gordon | last post by:
I have 2 tables t and t1. In this case, t1 is a copy of t. I want to delete rows from t1 based on criteria on the t table and a relationship between t ad t1 (in this case the id column). In the...
0
by: Eric B. | last post by:
Hi, I'm somewhat new to MySql. I've been using it for a while, but pretty much out of the box setup, and am starting to suffer heavily with my larger tables. I have a table with 5,000,000+...
2
by: Fabien Penso | last post by:
Hi. I need a little help to optimize requests on a table, and I have no idea how to do it (I optimized already a lot other table, but this one is a pain). My table looks like : CREATE TABLE...
3
by: saracen44 | last post by:
Hi I have MyISAM tables When I'm deleting parent I want to delete children in the same time. How can I do It? What are possibilities? Thanks
2
by: Shashikant Kore | last post by:
Hi, I am using MySQL for a table which will have 100M+ records, avg length of records being 130 bytes. When the number of records reach approx. 25M (and the file size close to 4GB), the rate of...
48
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer with table Students I am tasked to produce a...
1
by: coyote2002 | last post by:
Hi, I have big problem with mysql 4.0.18 . Because my database is growing up, every night records that are older than some date are deleted. But size of database on disk isn`t smaller after this...
2
by: RottNKorpse | last post by:
Well I am trying to make an admin section to allow my other admins of my site able to add content to my mysql database without giving them phpmyadmin access and without teaching them out to use it as...
8
by: Daz | last post by:
Hi everyone. I was faced with the choice of whether my problem is indeed a PHP problem or a MySQL. I have decided it's a PHP problem as I don't experience the same problem when I execute the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.