Boy, you guys are die-hard MySQL fans :-) I think your
strong defending convinced us MySQL can handle 120
million records :-) But I know some ordinary users out
there like me who are not experts on tuning the MySQL
performance (they did send me private emails saying
they encountered the similar slow join problem). So
please help us to keep the faith.
We are trying to develop a simple biology database to
maintain some DNA Sequence information. My problem is
coming from the following two tables:
CREATE TABLE NewSequence
(
Seq_ID varchar(50) NOT NULL,
GenBank_Acc varchar(10),
Organism varchar(50) NOT NULL,
Seq_Type enum("EST","GSS","EST Contig","EST
Singlet","GSS Contig","GSS Singlet","GSS Plasmid
Contig","Protein") NOT NULL,
Seq_Length int NOT NULL,
Seq_Title text NOT NULL,
Comment text,
Entry_Date date NOT NULL,
PRIMARY KEY (Seq_ID),
UNIQUE (GenBank_Acc),
INDEX (Seq_Type),
INDEX (Organism)
);
This NewSequence table is used to track some general
info about sequence. Notice I have to use text
datatype to describe "Comment" and "Seq_Title" fields;
therefore I have to use varchar for other string
fields. In addition, the Seq_ID is not numerical.
BTW, I found indexing on Seq_Type. Organism which are
very repeative still helps with accessing. This table
has 2676711 rows.
CREATE TABLE NewSequence_Homolog
(
Seq_ID varchar(50) NOT NULL,
Homolog_PID int NOT NULL,
Homolog_Desc varchar(50) NOT NULL,
Homolog_Species varchar(50),
PRIMARY KEY (Seq_ID, Homolog_PID)
);
This NewSequence_Homolog table is to track which
protein sequences (homolog) are similar to the
sequence I store in the NewSequence table. This table
has 997654 rows.
mysql> select count(*) from NewSequence s left join
NewSequence_Homolog h on s.Seq_ID = h.Seq_ID;
+----------+
| count(*) |
+----------+
| 3292029 |
+----------+
1 row in set (1 min 30.50 sec)
So a simple left join took about 1 min and half.
First, is this slow or I am too picky?
This is the "Explain".
mysql> explain select count(*) from NewSequence s left
join NewSequence_Homolog h on s.Seq_ID = h.Seq_ID;
+-------+-------+---------------+---------+---------+----------+---------+-------------+
| table | type | possible_keys | key | key_len |
ref | rows | Extra |
+-------+-------+---------------+---------+---------+----------+---------+-------------+
| s | index | NULL | PRIMARY | 50 |
NULL | 2676711 | Using index |
| h | ref | PRIMARY | PRIMARY | 50 |
s.Seq_ID | 9976 | Using index |
+-------+-------+---------------+---------+---------+----------+---------+-------------+
I am running MySQL 3.23.49 on RedHat linux 7.3 on a
dedicated server with 4 GB memory. The only setting I
changed is to copy the my-huge.cnf into /etc/my.cnf.
Qunfeng
--- "Michael T. Babcock" <mbabcock@stripped>
wrote:
> Qunfeng Dong wrote:
>
> >not-so-good performance (join on tables much
> smaller
> >than yours takes minutes even using index) and I
> seem
> >to read all the docs I could find on the web about
> how
> >to optimize but they are not working for me (I am
> >
>
> Have you stored a slow query log to run them through
> 'explain' and see
> why they're slow? Do you want to post some of them
> here so we can
> suggest what might be done to make them faster?
>
> --
> Michael T. Babcock
> C.T.O., FibreSpeed Ltd.
> http://www.fibrespeed.net/~mbabcock
>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
| Thread |
|---|
| • Can MySQL handle 120 million records? | B.G. Mahesh | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Qunfeng Dong | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael She | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 18 Dec |
| • RE: Can MySQL handle 120 million records? | Adam Nelson | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 18 Dec |
| • RE: Can MySQL handle 120 million records? | Joe Stump | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Gerald Jensen | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Aaron Clausen | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Paul DuBois | 18 Dec |
| • Database type question | Richard E. Perlotto II | 19 Dec |
| • Re: Database type question | Iikka Meriläinen | 19 Dec |
| • Re[2]: Can MySQL handle 120 million records? | Dyego Souza do Carmo | 19 Dec |
| • RE: Can MySQL handle 120 million records? | Wayne Lewis | 18 Dec |
| • Excluding records? | Eric Anderson | 19 Dec |
| • Re: Excluding records? | Adolfo Bello | 20 Dec |
| • Re: Re[2]: Can MySQL handle 120 million records? | Harald Fuchs | 19 Dec |
| • Re: Re[2]: Can MySQL handle 120 million records? | Paul DuBois | 19 Dec |
| • Re: Re[2]: Can MySQL handle 120 million records? | Paul DuBois | 19 Dec |
| • Re: Can MySQL handle 120 million records? | Muruganandam | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael She | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael She | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael She | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael Bacarella | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 18 Dec |
| • RE: Can MySQL handle 120 million records? | Joe Stump | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 18 Dec |
| • Can I build a web page to extract data? | Gary Hostetler | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Csongor Fagyal | 19 Dec |
| • Re: Can MySQL handle 120 million records? | Michael She | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jocelyn Fournier | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jocelyn Fournier | 18 Dec |
| • Re: Can MySQL handle 120 million records? | W. D. | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Jocelyn Fournier | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Csongor Fagyal | 18 Dec |
| • Re: Can MySQL handle 120 million records? | W. D. | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Csongor Fagyal | 18 Dec |
| • Re: Can MySQL handle 120 million records? | B.G. Mahesh | 18 Dec |
| • Re: Can MySQL handle 120 million records? | David T-G | 18 Dec |
| • RE: Can MySQL handle 120 million records? | JamesD | 18 Dec |
| • Re: Can MySQL handle 120 million records? | David T-G | 18 Dec |
| • RE: Can MySQL handle 120 million records? | Peter Vertes | 18 Dec |
| • RE: Can MySQL handle 120 million records? - Impressive! How do you guys do that? | Qunfeng Dong | 18 Dec |
| • Re: Can MySQL handle 120 million records? - Impressive! How doyou guys do that? | R. Hannes Niedner | 18 Dec |
| • Re: Can MySQL handle 120 million records? - Impressive! How do youguys do that? | Michael T. Babcock | 18 Dec |
| • Re: Can MySQL handle 120 million records? - Ok, If you guys really can handle tens of millions records, you have to help me to enjoy MySQL too :-) | Qunfeng Dong | 18 Dec |
| • Re: Can MySQL handle 120 million records? - Ok, If you guys really can handle tens of millions records, you have to help me to enjoy MySQL too :-) | Qunfeng Dong | 18 Dec |
| • Re: Can MySQL handle 120 million records? - Ok, If you guys really can handle tens of millions records, you have to help me to enjoy MySQL too :-) | Jocelyn Fournier | 19 Dec |
| • Thanks! Re: Can MySQL handle 120 million records? - Ok, If you guys really can handle tens of millions records, you have to help me to enjoy MySQL too... | Qunfeng Dong | 20 Dec |
| • Re: Can MySQL handle 120 million records? - Ok, If you guys really can handle tens of millions records, you have to help me to enjoy MySQL too :-) | Ryan Fox | 19 Dec |
| • Re: Can MySQL handle 120 million records? - Ok, If you guys really can handle tens of millions records, you have to help me to enjoy MySQL too :-) | Brent Baisley | 19 Dec |
| • RE: Can MySQL handle 120 million records? | JamesD | 19 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 21 Dec |
| • Re: Can MySQL handle 120 million records? | Michael She | 21 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 23 Dec |
| • Re: Can MySQL handle 120 million records? | Michael She | 21 Dec |
| • RE: Can MySQL handle 120 million records? | JamesD | 21 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 22 Dec |
| • Re: Can MySQL handle 120 million records? | Michael T. Babcock | 23 Dec |
| • Re: Can MySQL handle 120 million records? | Jeremy Zawodny | 23 Dec |
| • DELETE with no WHERE clause | Gordon | 23 Dec |
| • Re: DELETE with no WHERE clause | Dennis Salguero | 24 Dec |
| • re: DELETE with no WHERE clause | Victoria Reznichenko | 24 Dec |
| • RE: Can MySQL handle 120 million records? | JamesD | 21 Dec |
| • RE: Can MySQL handle 120 million records? | Dean Harding | 21 Dec |
| • RE: Can MySQL handle 120 million records? | JamesD | 21 Dec |
| • RE: Can MySQL handle 120 million records? | David Brodbeck | 18 Dec |
| • RE: Can MySQL handle 120 million records? | Greg_Cope | 18 Dec |
| • Re: Can MySQL handle 120 million records? | Paul DuBois | 18 Dec |
| • RE: Can MySQL handle 120 million records? | RBRoa | 19 Dec |
| • RE: Can MySQL handle 120 million records? | Dana Diederich | 19 Dec |
| • RE: Can MySQL handle 120 million records? | John Griffin | 19 Dec |
| • Re: Excluding records? | King_Henree@yahoo.com | 20 Dec |