Optimize Or Repair Db Tables
I bought a dating script online and been running it for 1 year, has about 1500 profiles, but the site is too slow now. Not about the host because I have godaddy host. When I ask the script owner, they told me that I need to optimize the db to make tables indexed. I already tried to go to phpmyadmin, click on all tables, then, select OPTIMIZE table from drop-down list,.... but it does not help. The site is still running too slow to load. I am using high speed intenet.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
ANALYZE, OPTIMIZE, CHECK, REPAIR
when to use the ANALYZE, OPTIMIZE, CHECK, REPAIR commands. From what I can tell, ANALYZE and OPTIMIZE are for making the table optimal to increase performance. CHECK and REPAIR are used to find & fix corruptions. ANAYLZE takes a lot less time to run than CHECK. The questions I have are: 1. What is the general rule of thumb on regular (daily) maintenance of a MySQL DB? 2. Will ANALYZE report table corruptions? If so, I don't even need to call CHECK, I can directly go do REPAIR? 3. If the anwer to #2 is no, meaning I have to run CHECK TABLE, should I separate the optimization exercises from the find-corruption-and-repair routines?
Check Table And Repair Versus Optimize Table
I am confused about the difference between running a CHECK table and REPAIR(if necessary) versus running an OPTIMIZE table. It's not very clear in the documentation, but seems that OPTIMIZE table does a check and repair in addition to the other functions performed by optimize. I have inherited some legacy code that does a check and repair and optionally follows it with an optimize. That seems redundant to me and I would like to streamline the code to make it an "either-or" selection.
Cannot Repair Tables
I lost my developers and an office i do hardware support for is down. I can do the basics, BUT checking and repairing the tables dont seem to work. I need some better direction. Here is a link to a text file that shows ALL of the errors. Can someone please reply with answers or even a direction to go. The is NO backup of the database and the data is vital. http://members.planetwebdev.com/web/admin/mysql/report.txt if "holy $#%@%#$" is the only answer you have. Please spare me your comments.
Repair Corrupt Tables
I have a couple of tables in a database the give me the following error when I try to open them: thanks! 'can't open file: 'clinch_a.ibd (errno:1)' What can I do to fix this problem.
Repair Mysql Tables
is there some code to repair all the tables in my database in one go? instead of typing in "Repair Table <TableName>;" many times.
Auto Repair Tables
This is my first post on this board. Well.. now to my question. I´m running MySQL 4.1.11 on a linux-mandriva server. Some days, there are a few tables in on of my databases that gets "corrupted" for some strange reason. And this always happends, when i´m NOT around to repair the tables. So.. i was wondering if there is some kind of php-script or program, that could repair the tables automaticly
How To Repair A Db ?
when I execute from command line (linux centos server) # mysqlcheck -o chatspa_main chatspa_main.BAmigMSG error : Can't find file: 'BAmigMSG.MYI' (errno: 2) chatspa_main.BuscaAmigos error : Can't find file: 'BuscaAmigos.MYI' (errno: 2) chatspa_main.CLKEXclkcontrol OK chatspa_main.CLKEXmain OK chatspa_main.CLKEXstats OK chatspa_main.CTICelebPhotos error : Can't find file: 'CTICelebPhotos.MYI' (errno: 2) chatspa_main.CTICelebrities error : Can't find file: 'CTICelebrities.MYI' (errno: 2) chatspa_main.ChatSpain_Users OK chatspa_main.MCmain error : Can't find file: 'MCmain.MYI' (errno: 2) chatspa_main.MCvotecontrol error : Can't find file: 'MCvotecontrol.MYI' (errno: 2) chatspa_main.phpCardData error : Can't find file: 'phpCardData.MYI' (errno: 2) chatspa_main.phpCardUsers error : Can't find file: 'phpCardUsers.MYI' (errno: 2) chatspa_main.phpCatData error : Can't find file: 'phpCatData.MYI' (errno: 2) How to fix/remove these "Can't find file" errors please ?
Repair Table
Is there a way to issue a "REPAIR TABLE table_name" command to all tables at once? Something like "REPAIR TABLE *"
Repair By Sorting
I have an application which uses MySQL to manipulate large amounts of data for short periods of time. The data set contains 13 columns each of which is indexed and typically about 30 Million rows. I create a new table, load the data in to the table using load local infile from a CSV and then add indexes to each of the columns; the columns are a combination of integer, date and text. The text columns have a simple index and a full text index. I need to be able to sort on each column (in a grid - I use DevExpress) and search on the textual fields. I appreciate that getting the data into MySQL and creating the indexes is never going to be quick but I need to optimise this process as much as possible. Typically a data set would be loaded and viewed for a few hours and then a new dataset loaded and the process repeated. When the index process is underway I get the above state displayed by show processlist and wondered if this is a problem. The whole load/index process takes about an hour and I would like to improve on this if I can. I am also looking for suggestions as to how I may be able to best optimise this. I use a dedicated server and the MyISAM engine.
Repair Message
Running MySQL 4.0. I had an error in my database that wouldn't let me run selects (it said error 127 from table handler). I ran repair on the table and it fixed it dropping one row. I was just wondering what the meaning of the repair message is so that I can try to avoid the error in the future. Found link that points at 11548 (outside data file) at 10152.
REPAIR TABLE
Can REPAIR TABLE be used for rebuilding indexes on an InnoDB table? The only documentation I have seen is for MyIsam. There are 30 million records which has taken me 9 days to populate. I've made a backup but want to make sure this will work before I try it.
Keycache Repair
I ran the following querry on a large database: ALTER TABLE vbpost ADD FULLTEXT INDEX (title,pagetext). The querry is taking a very long time to execute (the database is also very large). I logged in with another shell and ran showprocess. It showed the querry in state keycache repair. Do I need to do anything at this point? Is there a way to tell if the querry is still running?
REPAIR Repeatedly
I'm running MySQL 4.018 on Fedora. I've got a few tables with more than 1M records, and if a larger number of deletes is thrown at them or a MYSQLDUMP is attempted, I get a "got error 127 ...". I've run "REPAIR", MYSQLCHECK and every other repair possibility I could find. The tables are supposedly ok after the repair operation, and can be queried normally. As soon as I try to run a MYSQLDUMP or a large number of deletes, I get the corrupted tables again.?
Can't Repair A Table
It seems I have a corrupt table and have tried the REPAIR TABLE command but during the operation I get this return. mysql> REPAIR TABLE users; +-----------+--------+----------+-------------------------------------------+ | Table | Op | Msg_type | Msg_text | +-----------+--------+----------+-------------------------------------------+ | sdc.users | repair | error | Can't open file: 'users.MYD'. (errno: -1) | +-----------+--------+----------+-------------------------------------------+ 1 row in set (0.00 sec)
Mysql Crash/repair
I've got a couple of directory sites that looks like somehow something's been deleted or crashed (the directory isn't showing any listings). I had a look in the mysql directory, and all I see are a bunch of .frm files. I don't see any MYI or MYD files. Is there any way to recover or repair? I'm assuming I need those files, and that the lack of them is what's causing my problems. We've done a couple of things lately that may have caused the problem like a server move and a hard reset.
Repair Corrupt Table
I am using xoops (a CMS) and MySQL on a website with not so much traffic. I am using "phpMyAdmin - 2.8.0.3-Debian-1" with "MySQL - 5.0.21-Debian_3-log" on a Debian unstable. Three tables have gotten corrupt recently and won't let themselves be repaired. When I use repair it says status OK, but if I try to delete a record or if I analyze the table again, it says that the table was reported as crashed and that it needed a repair. The only useful message I get, if I analyze the table is about wrong key at page 111616.
Server To Repair Mysql DB
I've got a corrupt 8GB mysql table and am obliged to use myisamchk -r -o -f --safe-recover But this is taking immensely long time, and is going slower and slower The time it would take to repair 2.7 million rows would be far too much than I can make my client wait.is there somewhere a service where I could sync a copy of the db files under /var/lib/mysql/, repair it on their powerful server, and bring it back home?
Indexing Table Forces Repair By Sorting
I have a problem whereby i am loading a large table into MySQL - approx 3 million rows I then create indexes on most of the columns including normal and full text indexes on certain columns that I need to sort and search. The indexing operation takes an age (about 7-8 mins) on each column, whether it is a normal or fulltext index. Example: mysql> show full processlist; | Id | User | Host | db | Command | Time | State | Info | | 1196 | root | PAULS:2078 | registries | Query | 457 | Repair by sorting | CREATE INDEX VALNAMEidx ON FULLTAB_113 (VALNAME (64)) | 5 rows in set (0.01 sec) I have tried SET MYISAM_SORT_BUFFER_SIZE=1024000000 - this has no affect I have also tried creating the indexes when I create the table but I get the same thing. The tables are populated by load data local infile and no additional rows are added once populated I am running MySQL 5.0.11 on a dual core pentium 2.4Ghz with 2GB RAM Any ideas how I can speed this up?
Mysqlcheck: Table Is Marked As Crashed And Last Repair Failed
I'm using the command "mysqlcheck --all-databases --auto-repair --silent" and I see these warnings and errors (listed below) on a daily occurrence. What could cause these indexes to be out of order? Another thing I don't understand is why an increase in the number rows constitutes a warning? Hoping to here from MySQL users who have came across this. I'm using the MyISAM storage engine and MySQL 4.1.11 on Red Hat Enterprise Linux.
MYSQL Database Alteration, Repair And Restore Takes Huge Time
I am trying to run alteration queries on one of my mysql tables which has more then 22,00,0000 lakh records. Its been 23 hours and the process is still running (I have to close all the sites running on server due to same). My server specifications: Red Hat 9.0 Pentium 4 3.0 GHz 2 GB Ram, Burst RAM 5 GB Running webserver, mail server as well. Is there a way I can view the minute process details, as what table record is being updated ?
What Does OPTIMIZE Do
I use phpMyAdmin and constantly see the OPTIMIZE TABLE option on the structure page with a number of bytes highlighted. You press the button and the bytes are gone! Great!!! But what exactly did that just delete? Should you optimize or just leave the databases as they are? Is there a chance of corrupting the data in a table when you run this?
Optimize This Sql
optimize this sql SELECT DISTINCT(ibf_posts.author_id), ibf_topics.* FROM ibf_topics LEFT JOIN ibf_posts ON (ibf_topics.tid=ibf_posts.topic_id AND ibf_posts.author_id=25869) WHERE ibf_topics.forum_id=4 and ibf_topics.approved=1 and (ibf_topics.pinned=1 or ibf_topics.last_post > 0) ORDER BY pinned DESC, last_post DESC LIMIT 0,30 .
Optimize
the following query takes forever on 80,000 records. I was wondering if there was anyone that sees how I could speed this query up. SELECT c.products_model AS model, SUBSTRING(warehouse_sku FROM 4) AS sku, a.products_id AS products_id, products_viewed FROM products_description AS a, products AS b, products_to_warehouses AS c WHERE a.products_id = b.products_id AND b.products_model=c.products_model AND warehouse_id = 2 ORDER BY products_viewed DESC;
Optimize And Tuning
i was reading a post from long ago, and suggest for better performance at the mysql server to check the queries adn then make an optimization. i have this db that's eating lots of resources, and usually reaches 90% for the cpu and almost everything is used by the mysql. i supposse it´s a matter of tuning vars, wich one would you suggest to tackle first, and what others next in an myisam engine
Shorten/optimize This?
I have 3 fields I want to search: categories table's Title field. items table's Title and Info fields. The titles are < 25 chars, and Info < 50 characters. So, I figured a LIKE '%SEARCH%' is best... is there something else I should do? Right now I split up each word in the search, so a search for "multiple word search" gives me these two queries: SELECT Id, Title FROM categories WHERE Title LIKE '%multiple%' OR Title LIKE '%word%' OR Title LIKE '%search%' SELECT Id, Title, Info FROM items WHERE Title LIKE '%multiple%' OR Title LIKE '%word%' OR Title LIKE '%search%' OR Info LIKE '%multiple%' OR Info LIKE '%word%' OR Info LIKE '%search%'
How Can I Optimize This Query?
tables: --------- branch: PK = branch_ID (has many) galleries: PK = gallery_ID FK = branch_ID (has many) photos: PK = pic_ID FK = gallery_ID query: select x,y,z from galleries join photos on photos.gallery_ID = galleries.gallery_ID where galleries.branch_ID = 1 order by photos.img_weekHits desc,photos.img_hits desc limit 0,1; explain says the following: --------- table: galleries type: simple possible keys:3 ref: const rows: 200 extra: Using where; Using temporary; Using filesort --------- type: simple table: photos ref: galleries.gallery_ID rows: 35 extra: Using where I need to run this query for each branch of my website (currently there are 7). the query gets the most popular picture for the week from that branch. All fields used in where, joins and order by are indexed. The photos table has 40 000+ rows in it. The galleries table has 500+ rows in it. The query takes about 3-500ms on my laptop to run for my busiest branch, and less for less busy branches. The page that runs the query is cached, so the query is only run every half hour or when new content is added or the cache is flushed. Is there any better way i can run this query, or alternatively achieve the same result with putting less load on the server?
Can I Optimize This Process?
I have a script that reads data records from MySQL and creates a table of all the records and their subsequent data for viewing. Each page of the script will only show 10 records, but with over 10,000 records, there are many many pages of records... thus I have pagination links at the bottom. Now for the pagination to work correctly, I have to count the total number of records in the specified query, but to display only the 10 records per page, I have to run the same query a second time and add the LIMIT clause with start and display limit parameters. So right now I am calling the same query essentially twice, only the second time I specify the LIMIT clause. These queries are rather huge with multiple joins and many many columns of data. Is there any way I can optimize this process and get the total record count of the specified query for pagination purposes, but also be able to limit the start and display count for each page as aforementioned. Or is this something I just have to use 2 seperate queries for?
Optimize Mysql
how to optimize my mysql server. I'm using DELL 2850 with 3Gb cpu and 2Gb RAM, Redhat Enterprise 3 and MySQL 4.1. Every 30-50 minutes mysql will be busy & very slow. Code:
Optimize Problem
I have a large'ish mySQL table, very text heavy (although no fields are larger than varchar 255). I do a bulk update once a day, which probably removes a 1/4 of the records, replacing them with fresh records. I find my table swiftly becomes massively inefficent, with the reported overhead soon exceeding the actual size of the table. So my questions are: (a) why does this happen? and (b) is there some programmatic way to perform the OPTIMIZE from my java updating process?
Deletion And Optimize
I have a summary table which gets updated every half hour. Each half hour I delete the previous record for that day and the new records are summed up at the end of each half hour and gets inserted. This table has no primary/unique keys but only indexes. After the insertion I do a optimize. This generally takes some time to optimize. Is it good idea to optimize the table after each deletion. I would like like improve the performance of my servers and also the query retrival time.
Optimize Query
What indexes are required to speed up the following query. SELECT COUNT(*) AS cnt FROM company WHERE state = 'Maharashtra' AND city = 'MUMBAI' AND companyName REGEXP '^D' GROUP BY parentid;
Optimize Search
If you want to retrieve data in a 10000 rows-table w/ simple WHERE clause, eg: select this where col1=val1 and col2=val2, this'll take forever (I would think, I never worked a database with such capacity.), 'cause all rows are accessed sub-sequentialy. Are there ways to optimize this search? I read in some articles one way to do it is by indexing, but I don't quite understand how this indexing works,
Optimize Table
Optimize table in mysql is nice!! but seems to require table names. Any way I can run it for my entire db? I like to do this in a batch process from time to time. FYI, I was having SERIOUS perf. problems on my box, until I optimized the tables that had huge number of rows deleted. Don’t believe the mysql documentation that this is not needed.
OPTIMIZE TABLE
Is it safe if the 'OPTIMIZE TALBE [table_name]' query is issued frequently(every 30 second)? The MySQL manual,[13.5.2.5. OPTIMIZE TABLE Syntax], says, "In most setups, you need not run OPTIMIZE TABLE at all. Even if you do a lot of updates to variable-length rows, it is not likely that you need to do this more than once a week or month and only on certain tables."
Optimize Query
I'd like to optimize this query:Code: SELECT * FROM `links` WHERE active = "1" AND mainweight != 0 ORDER BY Rand()*(1/mainweight) LIMIT 5 I have a database of links wich has 3 000 rows. I'd like to select weighted random links from it (mainweight is the weight of the link). On my serwer this query is executing 0.8 sec. When i have 50-100 users on my site this is a problem.
OPTIMIZE Database
I've recently noticed that my database has some overhead, and i would like to go about solving this issue, a short search on this forum noted something about running OPTIMIZE on the database or something like that, is there anyone that may know what exact command i need to run to OPTIMIZE the database (via PHPMyAdmin)
Optimize Problem
I have a large'ish mySQL table, very text heavy (although no fields are larger than varchar 255). I do a bulk update once a day, which probably removes a 1/4 of the records, replacing them with fresh records. I find my table swiftly becomes massively inefficent, with the reported overhead soon exceeding the actual size of the table. So my questions are: (a) why does this happen? and (b) is there some programmatic way to perform the OPTIMIZE from my java updating process?
Optimize - NULL V.s. 0 Or ''
To optimize a fairly large table with variable length fields, is it generally better to use a default value of NULL or an empty string? ex: for char types, use NULL in stead of '' or for numeric types, use NULL in stead of 0 if there was a notable advantage/disadvantage to a lot of NULL values in a large table, and if so whether it is due to disk storage requirements or processing time/overhead?
Optimize Question
if the following is the best way to construct a table for searching x, y, and z coordinates (especially for ranged search retrievals <, >, <=, >=, etc) Code: create table map ( x smallint unsigned not null, y smallint unsigned not null, z tinyint unsigned not null, t smallint unsigned not null, primary key(x, y, z) ) The t column is simply the data at the xyz coordinate
Optimize Rand() On A Big Database
I am using RAND() and I know it is killing my MySQL performance. My database is currently at 200K rows and growing quickly. Here is a general mysql SELECT that is looped about ten times depending on the page. PHP if($drange == "thisweek") { $subquery = "SELECT articles.title, articles.link, articles.date, site.site_name FROM articles,feeds,site WHERE articles.article_id != $articleid AND (week(articles.date)=week(now()) AND year(articles.date)=year(now())) AND articles.feed_id=feeds.feed_id AND feeds.sub_id=$subid AND feeds.site_id = site.site_id ORDER BY RAND() LIMIT 3"; } I am trying to optimize this to NOT use RAND(). For this query, it is looking at all the latest additions over the past week. I have thought about running this query only selecting the IDs of the rows, then randomly selecting 3 numbers out of the selection and running the query again just to select the rows. But would that be faster?
Optimize SUM() Function With JOIN
SELECT DISTINCTROW marketing.ID, marketing.jobID, marketing.courseID, marketing.type, marketing.date, marketing.mktArea, marketing.firmsType, marketing.indvType, marketing.codes, marketing.specs, marketing.topbox, marketing.finalExport, marketing.notes AS FirstOfnotes, Sum( bookings.amtPaid ) AS SumOfamtPaid FROM marketing INNER JOIN bookings ON marketing.ID = bookings.marketingID GROUP BY marketing.ID, marketing.jobID, marketing.courseID, marketing.type, marketing.date, marketing.mktArea, marketing.firmsType, marketing.indvType, marketing.codes, marketing.specs, marketing.topbox, marketing.finalExport; EXPLAIN shows: id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE bookings ALL NULL NULL NULL NULL 67289 Using temporary; Using filesort 1 SIMPLE marketing eq_ref PRIMARY PRIMARY 4 plt.bookings.marketingID 1 The index is working fine on marketing.ID (the primary key) however i cant find an index which works on the bookings table. Ive tried adding a key on bookings.marketingID however it shows it up as a possible key but doesnt use it. Ive also tried creating a composite key of bookings.amtPaid and bookings.marketingID, it uses this key however the number of rows it has to look through stays the same. I cant see what else I can do to optimize this query. It takes a while to open as for every marketing.ID it has to work out the SUM of the booking.amtPaid.
Precedence In WHERE Clause - Trying To Optimize
How can I optimize a query like: SELECT COUNT(*) FROM ((table1 o INNER JOIN table2 j ON o.ID = j.ID) INNER JOIN table3 f ON j.f_ID = f.f_ID) INNER JOIN table4 c ON c.f_ID = f.f_ID WHERE j.end = ��-00-00' AND c.dateC > j.startDate AND c.sub = 'Y' AND f.l_ID = '$lk_ID' AND c.show = 'Y' AND c.dateC BETWEEN '$lastyear' AND '$today' Do I look at the which parameter in the WHERE clause will have the fewest records and put that first in the WHERE clause? Then the next fewest,...
MySQL Is Slow, Trying To Optimize
It just seems that my system is slow, adding records, etc. I tried to optimize it, saw that there was a my-medium.ini file, read that is was for medium sized system. I replaced it with my.ini (yes I did make a backup, thankfully) and restarted mysql. Pretty much it hangs. I tried to connect with QueryBrower, did a Select Count(*) and just froze. I admit that I didn't wait for ever, yes I know I Select Count(*) takes a long time but I gave up after waiting 3x as long as I normal did. Also the logs screen froze in administrator.
Optimize Table With LOCAL Arg
I am running mysql 4.0.16. Optimize table does not work with LOCAL or NO_WRITE_TO_BINLOG options, and gives me mysql error. Any ideas?
Optimize Select Statement
I have a big simple table with 3 fields and 700,000 records. Table: mytable Field1 Field2 Field3 name1 initial1 1 name2 initial2 0 name3 initial3 0 name4 initial4 0 ... ... ... i like to be able to do a fast search where it can return the first record that has 0 in field3. If i go through the whole table, it takes too long. Select * from mytable where field3 = 0; <---- it takes too long to do this i would like to get the record # 2 because this is the first record that field3=0
Usage Of OPTIMIZE Command
I had a table of more than 800'000 rows where I deleted approx 200'000 rows. The documentation says that I shouldn't normally have to use the OPTIMIZE TABLE command, but performance on this table has not improved. Is it a good idea to use it?
Optimize A Select For Birthday
I need to select all the clients in my database that celebrate their birthday in the first/last half of the month. The table has an index on the birthday field. I used the next statement: select buc from clientes where Month(FechaNacimiento)=5 and DAY(FechaNacimiento)<16 to obtain ~13,000 clients, but it takes a while to do it. The explain output says that it will use the index, but estimates the 10 million record scan. Is there another way to express the WHERE clause to help MySQL optimize the search?
Optimize My Snort MYSQL DB
We are using SNORT IDS which connect to a MYSQL DB, the SNORT IDS has been running for long long time and it got a lot of data in MYSQL DB. Nowadays, the snort web interface has become extremely slow and my friend said it is bcoz there are too much data in MYSQL and MYSQL was not optimized for long time. May I know how do I do some maintenance or optimize the MYSQL for it to run faster? I used optimize table, and repair table command for all tables already but the web interface is still slow
Stop Optimize Table
While trying to shorten my files, I tried optimize table - later I found that I need: mysqlcheck -u root -p[password[ --all-databases --analyze --optimize (thanks to Markus Popp). But it gives this error: mysqlcheck: Got error: 1044: Access denied for user 'root'@'localhost' to database 'information_schema' when executing 'OPTIMIZE TABLE ... ' How can I stop this? The optimise command seem to be in the way (and since I started it, my computer has got pretty slow)
|