If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > table too big

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-05, 13:35
Programmer Programmer is offline
Registered User
 
Join Date: Nov 2002
Posts: 50
table too big

Hello everybody

I have a table which i think got too big that when i use a select command to view records.. it gets stuck and don't show anything

Can somebody help me out with this problem?.. how can i view the records and see whats in it that it got so big.

Thanks in Advance
__________________
Deep
Reply With Quote
  #2 (permalink)  
Old 01-26-05, 13:53
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
insufficient information

please show the table layout

please show the query that didn't work

please show the results of this query --
Code:
select count(*) from tablename
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-26-05, 14:00
Programmer Programmer is offline
Registered User
 
Join Date: Nov 2002
Posts: 50
Quote:
Originally Posted by r937
insufficient information

please show the table layout

please show the query that didn't work

please show the results of this query --
Code:
select count(*) from tablename
Thanks for the quick reply

sorry about the insufficient info

here's what I do

- i connect to mysql using mysql -u -p table_name

- then i use "Select * from table_name;"

- gets stuck at this point (because that table is too big)

- used status command and i got this

Connection id: ######
Current database: Database_Name
Current user: user@localhost
Current pager: stdout
Using outfile: ''
Server version: 3.23.58
Protocol version: 10
Connection: Localhost via UNIX socket
Client characterset: latin1
Server characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock

Threads: 34 Questions: 370451 Slow queries: 92 Opens: 277 Flush tables: 1 Open tables: 64 Queries per second avg: 0.050

I also notice that in my tmp folder.. i have this #sql6e8_2f52_0.MYD file.. which is over 64 gb .. and its not suppose to be that big.

I hope that helps
__________________
Deep
Reply With Quote
  #4 (permalink)  
Old 01-26-05, 14:06
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
please show the table layout

please show the results of this query --
Code:
select count(*) from tablename
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-26-05, 14:16
Programmer Programmer is offline
Registered User
 
Join Date: Nov 2002
Posts: 50
Hello

If i use select count(*) from table_name ... it gets stuck. I can't access that table

and heres i used describe table_name

and this is wat i got

+----------------+------------------------------------------------------------------------------+------+-----+----------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------------------------------------------------------------------------+------+-----+----------------------+----------------+
| SampleID | int(10) unsigned zerofill | | PRI | NULL | auto_increment |
| Name | varchar(50) | | MUL | | |
| TemplateType | enum('PCR(ss)','PCR(ds)','Phage','Plasmid(ss)','Pl asmid(ds)','Cosmid','BAC') | | | PCR(ss) | |
| SeqRunID | int(5) unsigned zerofill | | MUL | 00000 | |
| Lane | tinyint(2) unsigned | | | 0 | |
| Min | smallint(6) | YES | | NULL | |
| Max | smallint(6) | | | 0 | |
| ProjectID | int(7) unsigned zerofill | | | 0000000 | |
| Account | varchar(80) | | | | |
| Cost | tinyint(3) unsigned | | | 0 | |
| Charge | enum('yes','no') | | | yes | |
| NoChargeReason | text | YES | | NULL | |
| Problems | text | YES | | NULL | |
| Comments | text | | | | |
| SeSampleID | bigint(20) unsigned zerofill | | | 00000000000000000000 | |
| admin | varchar(20) | | | | |
| DateTimeOut | datetime | | | 0000-00-00 00:00:00 | |
| DateTimeIn | datetime | | | 0000-00-00 00:00:00 | |
| CD | int(10) unsigned | YES | | NULL | |
+----------------+------------------------------------------------------------------------------+------+-----+---------------
__________________
Deep
Reply With Quote
  #6 (permalink)  
Old 01-26-05, 14:38
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
i'm sorry, i have no idea

did you try the REPAIR command?

this exceeds my meagre admin skills

perhaps someone else will step in
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 01-26-05, 14:40
Programmer Programmer is offline
Registered User
 
Join Date: Nov 2002
Posts: 50
That's ok

Can you tell me how can I delete Last 100 records (the newest records added) added to that table?

the syntax please?

Thanks
__________________
Deep
Reply With Quote
  #8 (permalink)  
Old 01-26-05, 14:57
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
that's goint to be way more complicated that a simple SELECT COUNT(*) query
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #9 (permalink)  
Old 01-26-05, 15:03
Programmer Programmer is offline
Registered User
 
Join Date: Nov 2002
Posts: 50
yes..

but I can't access that table by any select statement... I'm not even sure if it will let me delete nething.
__________________
Deep
Reply With Quote
  #10 (permalink)  
Old 01-26-05, 21:52
J.D. J.D. is offline
Registered User
 
Join Date: May 2004
Location: NJ USA
Posts: 21
Did you try doing a select * from tablename LIMIT 20;

I am assuming your select statement is taking a long time because your table is large. The server is actually trying to retrieve all the results and send them to the client.

If you really need to delete the last 100 records. Run the SELECT MAX(SampleID ) FROM tablename. (This will certainly take a long time to run. So don't kill it, just let it run for a couple hours or days if need be.)

You can probably use this result to delete the last 100 records since SampleID is an AUTO_INCREMENT field.
__________________
J.D.
Database Administrator
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On