![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Dear mySQL community, I have once again turned to the user groups for a problem I cannot solve myself! Atually, I have read all I can from the newsgroups on this but I could not solve it myself. Here it is: mySQL server: version "4.0.20-standard" on localhost hardware : 1.8 MHz Pentium 4 with 512 cache and 512 MB 266MHz RAM and 40 MB Matrox+ harddisk Here is the problem: There is a table which I has 7 fields, 3000 records. One field is auto_number and is PRIMARY, second is an integer(12) field and is KEY, and the rest are varchar(255) fields. - This is the OLDTABLE I have created a new table, and repeated the table I just described over and over into this new table, there are now more than 3.6 million records. - This is the new NEWTABLE When I run a select like "select * from NEWTABLE where auto_number="BLAHBLAH" it returns the record in miliseconds. But when I query the integer(12) field "SELECT dnjNo FROM NEWTABLE where dnjNo='$dnjno' limit 25", it takes 2 and half minutes to tell me if the record does not exist, but only if does not exist, if it exists, then the 25 rows are returned in about 3 seconds and then in 0.2 seconds for subsequent search. Why does it take so long to tell me if a record does not exist? Any suggestions on how I can improve this performance, since without this how can I basically search for non-existant rows? Did I forget to say that the CPU is running at full during the 2 and half minute. Please help! ghasem |
#3
| |||
| |||
|
|
Dear mySQL community, I have once again turned to the user groups for a problem I cannot solve myself! Atually, I have read all I can from the newsgroups on this but I could not solve it myself. Here it is: mySQL server: version "4.0.20-standard" on localhost hardware : 1.8 MHz Pentium 4 with 512 cache and 512 MB 266MHz RAM and 40 MB Matrox+ harddisk Here is the problem: There is a table which I has 7 fields, 3000 records. One field is auto_number and is PRIMARY, second is an integer(12) field and is KEY, and the rest are varchar(255) fields. - This is the OLDTABLE I have created a new table, and repeated the table I just described over and over into this new table, there are now more than 3.6 million records. - This is the new NEWTABLE When I run a select like "select * from NEWTABLE where auto_number="BLAHBLAH" it returns the record in miliseconds. But when I query the integer(12) field "SELECT dnjNo FROM NEWTABLE where dnjNo='$dnjno' limit 25", it takes 2 and half minutes to tell me if the record does not exist, but only if does not exist, if it exists, then the 25 rows are returned in about 3 seconds and then in 0.2 seconds for subsequent search. Why does it take so long to tell me if a record does not exist? Any suggestions on how I can improve this performance, since without this how can I basically search for non-existant rows? Did I forget to say that the CPU is running at full during the 2 and half minute. Please help! ghasem |
![]() |
| Thread Tools | |
| Display Modes | |
| |