473,411 Members | 2,164 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,411 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 1860

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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.