MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

5
votes
1answer
2k views

What is the difference between XtraBackup and rsync?

Yes, I'm going to run strace on them both... However, I would like to know ... What is XtraBackup is doing over and above rsync -ac src dest ? What's so special about XtraBbackup ? How is XtraBackup ...
5
votes
2answers
9k views

What is the safest way to switch the binlog format at runtime?

Because of the following warning in mysqld.log: [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it ...
13
votes
2answers
5k views

How do I properly perform a MySQL bake-off?

I want to performance test (aka bake-off) MySQL server rpm against some other forks such as Percona server, MariaDB, and possibly some others. I'm hoping that by asking this question I can better ...
1
vote
1answer
672 views

How to Prevent an Ever-Growing index file (MyISAM engine) From Causing Disk Fragmentation in Windows (NTFS partition)?

We have a keep-growing table which using MYISAM storage engine. Almost every half year, this table will crash, and need to be repaired. I checked the defragment result reported by windows ...
4
votes
4answers
9k views

MySQL: Why is auto_increment limited to just primary keys?

I know MySQL limits auto_increment columns to primary keys. Why is this? My first thought is that it's a performance restriction, since there probably is some counter table somewhere that must be ...
3
votes
3answers
254 views

Effect of Oracle on MySQL

While the future of MySQL is unknown, I haven't had time to keep up with the known effects that Oracle has had on MySQL since it was bought from SUN. Have there been changes of note, either by Oracle ...
2
votes
1answer
2k views

Rebooting a MySQL Replication Slave

For the first time since it was set up I need to reboot a read-only MySQL replication slave. I found this article about downing a slave for maintenance (albeit he's just describing stopping the mysql ...
5
votes
1answer
572 views

Should I use a storage engine other than MyISAM to optimise these tables or should I get better disks?

There's a production database I'm working on, whose 4 largest tables contain between 4 million and 10 million rows each and about 15 fields each, with indexes on different field types (numbers, ...
4
votes
3answers
655 views

MySQL very slow query when changing one WHERE field despite no index/key

This is quite a confusing issue for me. I have a database full of baseball statistics. Running this query: SELECT * FROM hits JOIN stadiums ON stadiums.gameName = hits.gameName JOIN players ON ...
1
vote
1answer
134 views

String Pooling for MySQL

So I'm having this table that logs all errors happened in our production code. It looks like this: id | date | type | message | file | line ...
2
votes
3answers
423 views

What's the easiest way to re-format CSV exports from MySQL into Excel/ flat-file fields?

I've just had some database backup problems on a website I run containing some important lead data. Unfortunately, I've now lost one of the key MySQL tables, which means my data has lost its ...
2
votes
2answers
514 views

What is an “empty query” in information_schema.CLIENT_STATISTICS?

The client stats table has an "empty queries" column. What does that mean? Simple googling just tells me "The number of times this client's connections sent empty queries to the server." /facepalm
8
votes
3answers
5k views

What is the default order of records for a SELECT statement in MySQL?

Suppose you have the following table and data: create table t(k int, v int,index k(k)) engine=memory; insert into t values(10, 1), (10, 2), (10, 3); When issuing select * from t where k = 10 with ...
3
votes
1answer
3k views

Can I rename the values in a MySQL ENUM column in one query?

Suppose I have a Database table with an ENUM('value_one','value_two'). I want to change that to an ENUM('First value','Second value'). I an currently doing that as follows: ALTER TABLE `table` MODIFY ...
0
votes
1answer
5k views

Setting default charset/collation for MySQL database

noob sysadmin here... I have a MySQL DB that used to be latin1, and I changed all the columns in all the tables to be utf8. However, I evidently didn't do all I had to do, because I just found that I ...
5
votes
2answers
3k views

Will these two queries result in a deadlock if executed in sequence?

This is almost certainly the cause of my other question, but I thought it was worth separating the two as I have a hypothesis based on the following log that I would love to have falsified or ...
3
votes
1answer
202 views

Is SQL_CALC_FOUND_ROWS Safe and Accurate for a Single DB User Environment?

I have a large MySQL web application that uses a single user for all of its database queries. We have multiple databases running off of a master-slave replication setup. My question is this: We use ...
3
votes
1answer
2k views

Restore dropped mysql database

I create a database each year from the previous year, back up and then clean up the tables. So I have databases for the past 3 years. This year I did not do a backup and accidentally dropped the ...
1
vote
1answer
601 views

How can I get the maxium number of concurrent connections to MySQL over a specific time interval?

I have a monitoring app that checks MySQL's Threads_connected and Max_used_connections variables every X seconds. Neither of these variables tells me what I want to know: The highest number of ...
3
votes
1answer
5k views

Can mysqldump dump triggers and procedures?

Is there any way of making a mysqldump which will save all the triggers and procedures from a specified db? Some time ago I read that mysqldump will also save my triggers, but it doesn't look like ...
3
votes
1answer
222 views

How do I configure a MySQL Cluster with a redundant mysqld host?

this is my first post here, so go easy on me. I'm trying to rebuild my data architecture (which is currently a set of one primary MySQL server and a redundant fallback; the tables are primarily ...
1
vote
1answer
259 views

MySQL Performance Planning

I am considering moving my existing script which is downloaded to be a hosted script. One of the things it does is to keep track of some stats. My concern is with heavy hitters (100,000 ...
1
vote
2answers
2k views

I cannot access local database on terminal (MAC)

I have access to my databases on phpmyadmin and mysql Workbench on my local computer but I have a problem when I try to access the server using Terminal. Originally, I had uploaded the databases on ...
4
votes
2answers
163 views

How to create multiple entries on index based on the fields of one row?

I never found a good way to index multiple fields of one row as entries of an index or simulate this feature on MySQL. The problem arises when you have fields working as tags or similar concept. Ex.: ...
6
votes
4answers
3k views

What should I ask at a MySQL DBA interview?

I am a software developer and am helping my team hire a MySQL DBA. The core challenges that we are facing are: Slower queries and performance due to Hibernate. Database management (backups, tuning, ...
7
votes
2answers
2k views

What's a good way to add a PRIMARY KEY to a large InnoDB table?

I have a table with around 30 million rows in MySQL 5.5 using the InnoDB storage engine. This table has a foreign key that links to another table with around 3 million rows. I want to add a primary ...
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? ...
10
votes
5answers
4k views

Where can I find the mysql slow log?

Just as the title says, where can I see it ? Are there any config options for it ( like how many ms would determine if a query is slow or not ) ?
3
votes
4answers
1k views

Is it feasible to have MySQL in-memory storage engine utilize 512 GB of RAM?

I am considering scaling up instead of scaling out. Therefore, I am interested to hear whether it is feasible to utilize the MySQL in-memory storage engine for a database that is 500+ GB, given that ...
0
votes
1answer
38 views

Should I record ID numbers in a table where I record who look whom profile page

This is how I have designed: visitorID visitedprofileID datetime Is it a good idea to add an ID (primary key) to the table, I mean recordID (primary key). (MySQL with PHP)
3
votes
3answers
811 views

Convert Oracle query to MySQL

I've just tried to convert this update command, which is Oracle sql, to MySQL with SQLWays and it failed with the following error: You can't specify target table 'animal_table' for update in FROM ...
1
vote
0answers
157 views

Pulling an Image from a Database vs pulling from a link to a directory [duplicate]

Possible Duplicate: Is it better to store images in a BLOB or just the URL? Files - in the database or not? I was wondering what the benefit is of pulling a varchar out of a database that ...
2
votes
2answers
133 views

How do I configure MySQL '5.1.49-1ubuntu8' to show multibyte characters?

I am using MySQL version 5.1.49 and I have now enabled UTF8 character encoding. The default character-set for MySQL is latin1. How can I change it show UTF8 characters? Even when I query a table ...
2
votes
1answer
3k views

Fixing MySQL errors recorded in error logs

Below is the extract of the most common lines of error being recorded in error logs on my PC: 110905 16:16:54 [Note] Plugin 'FEDERATED' is disabled. 110905 16:16:54 InnoDB: The InnoDB memory heap is ...
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 ...
1
vote
1answer
3k views

Invalid default value for DateTime when changing to utf8_general_ci

I'm trying to run a script to modify a database, this query ALTER TABLE cmContentVersion CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; gives this error ERROR 1067 (42000) at line 68: ...
2
votes
1answer
515 views

Estimating query time

Is it possible in MySQL to know beforehand query execution time? I mean how long it will take to execute the query. Generally its worthwhile to know how long any query can take to execute. At the ...
5
votes
1answer
3k views

my.cnf values not applying - Optimizing MySQL in CentOS LAMP

I have checked for other occurences of my.cnf and I have found only one occurrence of /etc/my.cnf. Then, I went ahead to fix in my values, e.g. query_cache_size etc. After saving and literally ...
3
votes
1answer
573 views

Is it possible to compare timestamps between rows?

I have a MySQL table reqs with (this is simplified from actual): | Field | Type | Null | Key | Default | Extra | ...
1
vote
1answer
74 views

Is storing values of a unique field shared between many web forms bad practice?

I am curious if it is considered a bad practice to use a unique table to store values asigned to a unique field that is shared between several webforms. The site with webforms will carry thousands or ...
4
votes
2answers
1k views

Trying to get multiple mysql instances running on Ubuntu dev box

I'm trying to get multiple instances of mysql running on a dev box for some testing. This guy is running ubuntu so the setup's a little different than our production setups. I'd like to find the ...
6
votes
2answers
2k views

How can I improve my SQL statement with weekly results with week starting on Thursday or any other day of the week?

I am a total newb, and I couldn't find a good way to do this anywhere. I have a database table that contains statistics that are recorded at various time throughout the week. The reporting week ...
1
vote
1answer
339 views

Precomputing expensive aggregations

I'm looking for a tool that will let me precompute expensive aggregations some time after rows have been inserted into a MySQL database. For example, if I often run a SUM() on a column, I'd like to ...
1
vote
1answer
6k views

store result set in temporary table, variable or separate variables within a trigger

I'm in the process of creating some triggers to store the the average rating for a given product on the product table. I've also been asked to store the total number of reviews for the product. So - I ...
3
votes
1answer
158 views

Extreme storage beasts

Intro I have derived this question from my previous question Single Drive vs Multiple Drives After getting a very detailed answer from a very helpful member RolandoMySQLDBA and learning the fact that ...
3
votes
3answers
698 views

Converting CHAR to BIT

I have a column with char(16) data type and it was mistakenly set to char(16) actually it should be bit(1) because it contains only three distinct values as follows: 16 characters long string 10 ...
1
vote
1answer
128 views

MySQL Index Questions

I have 2 MyISAM tables: table: search_hit with primary key: search_hit_id, and foreign key: search_id (150 million rows and growing with constant inserts) table: search with primary key: search_id ...
3
votes
3answers
2k views

When do hash indexes become reasonable?

MySQL natively doesn't support hash indexes. So, making a pseudo hash column and creating an index on a hash column needs some thinking. And it seems to be widely understood that if the text field is ...
0
votes
1answer
106 views

How should I model this data?

I have a need to model the following requirement for a web application (PHP/MySQL5): A user can compete in a distance-based challenge which consists of entering progress along a defined ...
4
votes
2answers
2k views

Database design for dynamic Meta fields of an entity that shall be queried intensively

I'm designing a database structure for a system at which an entity can have a dynamic set of user-defined meta attributes. The meta fields (e.g.: popularity, conversion etc.) and skill values (int, ...