MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

3
votes
2answers
1k views

Separate tables or partition one huge table?

I'm building a rather large table that includes a particular column, my_column. There are a small-ish number of possible values for my_column, and each unique value of my_column should have the same ...
3
votes
2answers
994 views

Concurrently update with limit mysql

I want to know if concurrently UPDATE .... LIMIT N will not overlap with more than one client querying the db. After UPDATE ... LIMIT N the client will make a SELECT with some client_id assigned. I ...
1
vote
2answers
151 views

Why is MySQL not using the index with the higher cardinality?

I have an index called source with cardinality of 1122 and a second index called state with cardinality of 22. MySQL keeps using the state index when when query SELECT C1 FROM tbl WHERE source = 'x' ...
14
votes
5answers
6k views

In MySQL, does the order of the columns in a WHERE clause affect query performance?

I am having performance issues on certain database queries that have large possible result sets. The query in question, I have three ANDs in the WHERE clause Does the order of the clauses matter? ...
12
votes
1answer
13k views

INT(5) vs SMALLINT(5)

In MySQL table definitions is there a different between INT(5) and SMALLINT(5)? Or do they both represent the same size?
6
votes
2answers
4k views

Ibdata usage and Recommendations?

I have a Production server On November 5,2011 the ibdata size was 100G. In Approximate 3 months it is increased to 200G.So it has just doubled its size.So it is a Huge Data.Currently lvm is 251G. I ...
6
votes
2answers
5k views

Dump only the Stored Procedures in MySQL

I need to dump only the stored procedures : no data, no table creation. How can I do this using mysqldump?
5
votes
1answer
776 views

Can I have an InnoDB master and MyISAM slaves with Full-Text for searching?

I'd like to use InnoDB on the master, for its transactional ability, but MyISAM on the slaves for the full-text search ability. Is this possible?
5
votes
2answers
973 views

Why does MySQL choose this execution plan?

I have two queries, select some_other_column from `table` order by primary_index_column asc limit 4000000, 10; and select some_other_column from `table` order by secondary_index_column asc ...
4
votes
2answers
963 views

Help with this SELECT in the same table

I have this table structure: id1 id2 1 2 1 3 1 4 2 1 2 5 I need to build a query to select id2 where id1 is not in id2. For example if id1 = 1 then only id2=3 and id2=4. I tried ...
4
votes
2answers
2k views

What happens when InnoDB hits its tablespace autoextend max?

The latest version of High Performance MySQL (3rd ed.) recommends that one: ...place an upper limit on the tablespace's size to keep it from growing very large, because once it grows, it doesn't ...
3
votes
1answer
1k views

Is there a MySQL engine or trick to avoid writing so many temp tables to disk?

I've got a web application connected to a database running MySQL. Here's the problem: a not insignificant number of queries create temporary tables and many of the tables involved have BLOB fields. ...
3
votes
1answer
3k views

How do I reduce the database size on AWS RDS MySQL?

I have an RDS MySQL database on Amazon Web Services. I want to reduce the size of the database in the control panel in order to save money. Q: How do I make it smaller? Their site says you have to ...
3
votes
1answer
103 views

Screwed up replication by sharing server ids

So I had my screwup for the week today. I was adding another pair of slaves and set the same server ID on the new slave as an old slave. The layout kind of looks like Master | | \/ | oldS | ...
3
votes
3answers
3k views

Mysql users deleted

I have a fresh centos 6.2 with mysql in 5.1.52. Then I saw two empty user name and I deleted that then I saw 3 root user deleted that and created one like this CREATE USER 'root'@'%' IDENTIFIED BY ...
2
votes
1answer
1k views

importing myisam 5.0 database into a 5.5 innodb server

I have MySQL 5.0 and 5.5 servers (but not a 5.1 server). The 5.0 server is myisam only, the 5.5 default is innodb. I need to move a database from the 5.0 server to the 5.5 server. The database is ...
1
vote
3answers
174 views

Why query_cache_type is disabled by default start from MySQL 5.6?

We've upgraded to MySQL 5.6 and start seeing the loading of db server increased significantly, and finally found out the query_cache_type is defaulted to off start from 5.6. We enabled it again and ...
7
votes
2answers
2k views

MySQL deadlock - cannot restart normally?

MySQL version 5.5.13-1 A snippet from the SHOW ENGINE INNODB STATUS\G: LATEST DETECTED DEADLOCK ------------------------ 111218 10:22:34 *** (1) TRANSACTION: TRANSACTION 1318D95B, ACTIVE 0 sec ...
6
votes
2answers
320 views

Less restrictive query return less result due to simple removing one additional constraint

Look at this query SELECT DISTINCT TB.ID, TB.Latitude, TB.Longitude, 111151.29341326*SQRT(pow(-6.185-TB.Latitude,2)+pow(106.773-TB.Longitude,2)*0.98839228980165) AS Distance FROM ...
6
votes
2answers
2k views

Why does MyISAM support FULLTEXT Searching and InnoDB does not?

I know the basic differences between the MyISAM and InnoDB engines. In MySQL 5.6 beta, InnoDB will support fulltext search. But, I wonder why previous versions of InnobDB didn't support FTS? My guess ...
6
votes
4answers
5k views

MySQL gives “Out of Memory” error when inserting a large file. From where is this filesize limitation arising?

I'm using a MySQL database to store files. The table I'm using is structured as follows: +--------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default ...
5
votes
1answer
1k views

Replicate MySQL 5.0 Master to 5.5 Slave?

We're planning out a series of server/software upgrades and were curious. We have a RHEL5 install running MySQL 5.0 that we'd like to replicate to a new (virtualized) server running CentOS 6 and ...
4
votes
3answers
1k views

What are the limits on the amount of slaves per master?

I currently have a Master with 2 slaves, all running MySql 5.5. What are the limitations on the amount of slaves I can connect to a single master? what parameters should be taken into affect?
4
votes
1answer
7k views

What can cause TRUNCATE TABLE to take a really long time?

I'm running MySQL5.5 with Master/Slave replication (1 master, 2 slaves). I have a process that runs once a week and truncate a specific table. The table is not large and only has a few thousands ...
4
votes
2answers
451 views

Why is a secondary index chosen over a clustered index for SELECT COUNT(*) …?

In this query: select count(*) from largetable; a secondary index is chosen: mysql> explain select count(*) from largetable; ...
4
votes
4answers
18k views

Call a stored procedure from a trigger

I have created a stored procedure in mysql using the following syntax. DROP PROCEDURE IF EXISTS `sp-set_comment_count`; DELIMITER $$ CREATE PROCEDURE `sp_set-comment_count` (IN _id INT) BEGIN -- ...
4
votes
1answer
2k views

Suddenly have to rebuild indexes to prevent site from going down

I have been having this problem for a while: http://stackoverflow.com/questions/7770695/mysql-query-slow-until-reindex-column It seems all is good and when I suddenly get a lot of writes to the table ...
4
votes
1answer
969 views

Determining max database and table size supported and present size

One of my MySQL databases has been running on a single PC from the last four years. Here is my setup: MySQL 5.5.14 Windows XP on NTFS partition All of my tables are using InnoDB engine Here are ...
4
votes
2answers
711 views

With MySQL Replication, what level of resilience is possible?

I've found lots of good material on setting up MySQL replication, but not much on what to do in the event of failures. Understanding the degree of resilience I can achieve is fundamental to designing ...
4
votes
3answers
560 views

Separate databases for front-end and back-end

The site I am working on has a lot of backend/cron activity, so there are between 5 and 15 queries being executed every second of the day. This can slow down page loads by a second or more. I was ...
3
votes
1answer
121 views

What if I want to keep using MyISAM

In my current use of MyISAM the databases are extremely small and kept for a few weeks after which time they are deleted and completely rebuilt with a clean slate. The script uses MYISAM tables and ...
3
votes
1answer
1k views

Binlog has bad magic number

I keep getting this error whenever I start MySQL. 121028 1:38:55 [Note] Plugin 'FEDERATED' is disabled. 121028 1:38:55 InnoDB: The InnoDB memory heap is disabled 121028 1:38:55 InnoDB: Mutexes and ...
3
votes
1answer
497 views

Select * from statement execute very slowly, innodb io read speed is low

I have a very simple query " select * from ap_statistic " running in my servers. the servers have the same hardware and software configuration (CPU 8 core, mem :32G, OS: redhat 5.5, mysql version: ...
3
votes
2answers
3k views

Trying to understand SHOW SLAVE STATUS\G

I have slave setup and looks like it is running fine. Below is a snapshot of it. show slave STATUS\G; *************************** 1. row *************************** Slave_IO_State: ...
3
votes
2answers
536 views

Sorting the Table and getting the position

I am able to sort a table using the following code:SELECT * FROM Persons ORDER BY LastName But I wanted to get the ranking/position of a person using that order. For example when I sort Person table ...
3
votes
1answer
1k views

Does `Seconds_Behind_Master` show exact Slave Lag from Master?

Does Seconds_Behind_Master show the correct result? I have also Implemented the mk-heartbeat replication monitoring. It was showing the other result in comparison with Seconds_Behind_Master. Which ...
3
votes
1answer
450 views

MySQL query 'going away' on executing INSERT ON DUPLICATE UPDATE statement with a 12524 character blob

I have a mysql insert on update query like so insert into table (col1, col2, col3) values (1,2,'huge blob with 12524 chars') on duplicate key update col3 = 'huge blob with 12524 chars'; col1, col2 ...
3
votes
1answer
1k views

Stuck outside MySQL! XAMPP - help please

I have been using xampp (on windows XP/XAMPP 1.7.4 /PHP 5.3.5) for quite a while now, and last morning I started to get some weird messages when I was developing my website, It happened yesterday and ...
2
votes
1answer
5k views

How can extract the table schema from just the .frm file?

I have extracted the data directory of mysql from a backup and need to get the schema from an old table, however it's a backup from a different machine. I have read a fair number of tutorials today ...
2
votes
1answer
834 views

MySQL upgrade 5.0.88 to latest

Very interesting and informative blog.. I have a question - i have a requirement of upgrading from 5.0.88 to latest version.. Why should i upgrade? if so, which version should i consider? What ...
2
votes
2answers
342 views

MySQL export user with semi-colon “;” on the end

I am trying to set up automatic export of user accounts from one server to import into another. I am running the following command; $ mysql -u root -p -B -s -e "show grants for 'myuser'@'localhost';" ...
2
votes
3answers
6k views

How to use 2 auto increment columns in MySQL phpmyadmin

Is it possible to use 2 auto increment values ? One starting from 0 Another starting from 4000400 Please help me
2
votes
1answer
741 views

How does mysql deal with queries that touches myisam and innodb tables?

In our mysql database, we use both myisam and innodb tables, though there are more myisam tables. QUESTIONS If a query involves both myisam and innodb tables, will the query use table lock or row ...
2
votes
4answers
722 views

Backup and restore “mysql” database

I use the following command to backup some normal databases: mysqldump --host=host --user=user --password=passwd --result-file=result.sql -R --single-transaction database_name My question is : do I ...
2
votes
1answer
1k views

MySQL Slave Relay Logging but not logging Binary Log

I have a master slave setup both mysql 5.5, the setup is fine except that the slave won't Binary log to the standard mysql-binlog only to the relay logs. I fear this may be due to my lack of ...
2
votes
1answer
290 views

Maatkit shows the MySQL replication error in one table, but won't fix it

We use MySQL 5.1 with a primary/secondary replication setup. I use mk-table-checksum from Maatkit to generate checksums on the master and perform consistency checks on the replica. mk-table-checksum ...
2
votes
1answer
132 views

How to use MySQL Server 5.6 for GeoIP replication?

I have downloaded the new MySQL Community Server 5.6 and I dont quite understand how to use it properly for GeoIP based replication across 20 nodes. I want to have one central node, then three smaller ...
2
votes
1answer
4k views

Mysql master-master replication auto flush old logs

I have mysql-5.1.41 master-master setup running on ubuntu machines and below is the configuration of a master: skip-host-cache skip-name-resolve event_scheduler = ON max_connections = 500 ...
2
votes
2answers
2k views

Problem with InnoDB “per table” file sizes

I Have configured the mysql server with innodb per table. There was a table watchdog having approximate 19GB of watchdog.ibd file. I have truncated the table now it has zero record. But the ...
2
votes
1answer
306 views

How to do MySQL User Accounting

I can't seem to find any information on this anywhere. I found a question here called Monitor MySQL activity per database? but that's not quite the answer either. I'd like to be able to log the ...