MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

3
votes
1answer
889 views

How to set datadir to different values based on the hostname in my.cnf?

How to set datadir to different values based on the hostname in my.cnf? I want to use the same my.cnf file on a Linux machine and a Mac OS X machine where the datadir should have different values.
1
vote
1answer
1k views

does last_insert_id() returns correct result when writes from multiple sessions?

I have a table in which there is a combination of 4 columns that will act as a unique key. Instead of using a composite primary key, I want to keep an id column as the primary key. This field is on ...
3
votes
1answer
1k views

mysql statement based replication - unsafe statements

I have recently set up statement based replication and my error logs are filling up with this error 121231 21:10:55 [Warning] Unsafe statement written to the binary log using statement format ...
2
votes
2answers
2k views

mysql replication: replicate all but one table to different database on different server

I got database1 on server1 and database2 on server2. Now I need to replicate a single table from database1 to database2 Now I thought that this would work: replicate-ignore-table = % ...
5
votes
1answer
1k views

Query not using index when it should

I have this query (below) which keeps hitting the table when it should be using the created index. Is there something simple I'm missing here? How can I get it to use the index instead of the table? ...
2
votes
3answers
4k views

Automatic MySQL Replication Fail-over Strategy

I want to know that if replication is down due to some reason as if master is down then what strategy should be followed so that the replication is up instantly without manually intervening the ...
4
votes
2answers
5k views

Why max_allowed_packet is larger in mysqldump than mysqld in my.cnf?

If you look at the sample config such as /usr/share/mysql/my-large.cnf, you will find.. [mysqld] max_allowed_packet = 1M [mysqldump] max_allowed_packet = 16M What is the point? Because when you ...
1
vote
1answer
192 views

Performance impact of including result column in indexed columns

I have a database (in MySQL, using InnoDB) that I am using for texture identification in a 3D image. In it, there will be a table of texels(texture pixels) with hue included, in the form of: texelid ...
3
votes
0answers
385 views

XtraDB Cluster Error : “IST first seqno 7 not found from cache, falling back to SST” in replication [closed]

I have a problem with MySQL clustering. My systems consist of: xtrabackup: version 2.0.2 MySQL: version 5.5.27 Distro: CentOS 5.7 64-bit my.cnf on the donor: [mysqld] binlog_format=ROW ...
1
vote
1answer
116 views

After piping a file with SQL statements to mysql, how can I keep the command line session open?

A file, in.sql, contains a CREATE TEMPORARY TABLE statement followed by some INSERTs that populate the above table. Temporary tables are purged after the session closes, so 'mysql -u user -p pass < ...
0
votes
1answer
179 views

How to number SQL results sequentially?

Given following query - SELECT name, age FROM students WHERE age > 22 The result is - name age ---- --- Kshitiz 23 Steve 22 Paul 24 How can I number the results sequentially? Like ...
2
votes
2answers
112 views

Optimizing index creation

One thing that has bothered me for awhile is creating many many indexes for the one table where the query only differs slightly or contains many of the same columns. An example case would be: table1 ...
3
votes
1answer
481 views

How to design sales model for escrow type payment process

I need advice for best sales model for payment process. Basically my system is kind of market place. There is two kind of transaction. Customer will pay full money to administrator. Administrator ...
3
votes
1answer
3k views

MySQL Replication and High Availability

I know this might not be a very good question to be asked in this site, but I really need some helps/hints to be directed to the right path. I want to have failover strategy for 2 MySQL servers which ...
3
votes
1answer
59 views

Model to handle music release artwork

I’m designing a FAN web page for one artist, more specifically, the discography section. The discography includes this entire artist CD’s, Vinyls, 8-tracks, cassette, etc. So far, I’ve build something ...
1
vote
1answer
303 views

Giving a name to a dynamic column

I have written a query to fetch a time internal: select *, (Time + interval '2012-12-18 13:36:47' minute) from chatnotiservice; Is it possible to name the (Time + interval '2012-12-18 13:36:47' ...
4
votes
1answer
139 views

help required with indexing and query optimzation

After browsing most of the posts and after running out for options I am posting here. I have a table with 76,222,954 (76M) rows. It collects web site traffic based on country. Here is my table ...
1
vote
3answers
421 views

Design for archiving a sorted list (with ability for a few INSERT)

I have a somewhat static sorted list of words which I want to save in a database table: -- simplified! -- Note: the rank/order of each item is NOT calculable from other values! CREATE table words ( ...
5
votes
1answer
267 views

Is it possible to determine mysql pre-allocated memory footprint

At startup, mysql will use some memory. Some of the memory is pre-allocated for "key_buffer" and "innodb_buffer_pool_size" ( and other things ). Is it possible to determine how much memory is ...
2
votes
3answers
657 views

How to select data in a sub query only once?

I have the following query: SELECT ordno from orders where ordno NOT IN (SELECT ordno FROM invoices) There are about 25000 records in each table. I have indexed the ordno column. The query ...
1
vote
1answer
336 views

Mysql database replication (failover solution)

Is there anyone know how to do "mysql database replication" with appfog ? In simple word, just want to use 2 databases sync (2 locations) and set one as master database, and other one as slave. if ...
0
votes
1answer
110 views

Multitable partition guide

We have a main table called tblLink in it will have a date field.The tblLink will have its primary key as foreign in few other tables too and one of the table will tblMainData which over time will be ...
1
vote
2answers
157 views

mysql cannot find database after dropped of it and restored

Due to some errors I decided to drop of all schema and then restore db structure from dump file. After restoration all other mysql server clients cannot find it (error 1164 ). Only mysqlworkbench ...
3
votes
1answer
500 views

Setting up MySQL circular replication in existing replication topology?

I have the following MySQL replication topology set up for fault tolerance/disaster recovery with master server A and slaves B and C: A replicates to B A replicates to C Both B and C are fully up ...
7
votes
3answers
785 views

Do I need to add a new single column index to a table if a multi-column index on that field already exists?

I've a table with a multi-column UNIQUE index on _job_id__ and __keyword_id__. Would I also need to add another index to __job_id__ if I have a frequent query which performs a GROUP BY on that ...
6
votes
2answers
1k 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 ...
1
vote
2answers
2k views

Mysql replication - Error No. 1146&1062

short version In master master replication, How to have one master write data with odd IDs and the other one with even IDs? Is it the way to avoid conflict? detailed version I wanted to setup a ...
5
votes
3answers
6k views

Fastest way to move a database from one server to another

I'm moving a single MySQL database (~10GB uncompressed) from one server to another on the same network. The current MySQL version is 5.1.41 and the new version is 5.5.24. The database contains both ...
0
votes
1answer
197 views

Where is my old partition in mysql show create table?

I am keep adding daily base partition for a table as e.g. ALTER TABLE tblData PARTITION BY RANGE (to_days(`dataInsertDateTime`)) ( PARTITION p20 VALUES LESS THAN (to_days('2012-12-25')), PARTITION ...
1
vote
2answers
451 views

mysql_select_db() very slow on a busy server

I have a MySQL Server with about 30 Databases and 1500 Tables. Overall size of the data is 2 GB. The Server has 16 GB RAM and an AMD FX-6100 CPU. Most tables are myisam. On average the server answers ...
2
votes
3answers
595 views

moving a 13 gb table to amazon rds

I am moving our current database server from a regular EC2 instance running mysql to a RDS instance. I moved all the databases using the amazon-suggested method, simply piping the mysqldump output to ...
1
vote
0answers
432 views

What's complexity of select * from table order by id desc limit a, b?

I'm displaying about 1,000,000 records separated by 10 records per page. select * from table order by id DESC limit a, b; In this query id is indexed, and b is 10. The querying time is fast when ...
2
votes
1answer
166 views

how to deal with foreign keys with fixed values (on a db-table-basis)

I have a control table that looks like this: CREATE TABLE `tbl_control` ( `tm_db_tbl` varchar(64) NOT NULL, `tm_key` int(11) unsigned NOT NULL, /* a bunch of other fields here */ PRIMARY KEY ...
2
votes
1answer
9k views

Multiple “GROUP_CONCAT”s with WHERE clause

In a table as id name type info 1 BMW car yes 2 Reno car no 3 IBM electronics no 4 Sony electronics yes 5 Mazda ...
2
votes
1answer
3k views

Is there a progress indicator for OPTIMIZE TABLE progress?

MySQL 5.1.4x (Windows) | Innodb I recently purged data from a mySQL DB (a few hundred thousand rows) and I'm planning to use OPTIMIZE TABLE LOGTABLEFOO1,LOGTABLEFOO2,LOGTABLEFOO3; to reduce the ...
4
votes
1answer
4k views

How soon after updating expire_logs_days param and restarting sql will old binlogs get deleted?

MySQL 5.1.x | InnoDB | Windows My mysql data directory is starting to fill up with bin logs. I currently have the following settings configured in my windows mysql server: [mysqld] log-bin ...
1
vote
1answer
301 views

Set up replication and migrate to InnoDB with low downtime

Current situation is this: I have a large legacy DB using only MyISAM tables, the size of whole DB is 4GiB, one of the tables contains over 10 million rows, so it is pretty large. The database is ...
0
votes
2answers
763 views

How to mix pairs of rows without JOIN (in a temporary table)?

I have a TEMPORARY table containing pairs of key/value as id col1 col2 type pair 1 key1 key2 key 1 2 value1 value2 value 1 3 key3 ...
6
votes
2answers
12k views

Why do MySQL tables crash? How do I prevent it?

I'm the Administrator of a Moodle site which had its Users table corrupted and it became unusable. Luckily, a simple REPAIR TABLE mdl_user made it work back again. The thing is that I don't know why ...
3
votes
2answers
199 views

Query taking too much time

My query is taking too much time to execute. Please help me here. mysql> explain select pcm.catalog_id from cat_produ_catal_map_defer pcm, cat_catal_catal_map_defer ccm, cat_catal_defer c ...
3
votes
1answer
818 views

Mysql Server optimization tips needed! (InnoDB)

I've recently been trying to optimize our mysql server but I've encountered some pretty serious problems on the way. We're running a game server which is coded in C#. We have two dedicated servers. ...
2
votes
1answer
463 views

Analysis of MySQL database in real time Amazon RDS similar to phpMyAdmin

I'm using a single Amazon RDS instance (medium) to power several WordPress websites running on a single Amazon EC2 instance. I used to have my databases on another EC2 instance and installed ...
3
votes
1answer
3k views

How to re-assign two variables in a conditional UPDATE

Consider a simple update as SET @var1 = 20; SET @var2 = 26; UPDATE table1 SET col1=IF(@var1>50, @var1 := @var1-col4, @var1 := @var1+col5), col2=IF(@var2>50, @var2 := @var2-col6, @var2); ...
1
vote
2answers
142 views

How to optimize this query?

Query: Select * from `t_event` where `create_user_id`=7 and (`event_create_date`)=('2012-12-18 00:00:00') and `event_type_cd`=11 and `domain_id` =602 and `job_id` =1 limit 1 Table structure: ...
0
votes
1answer
148 views

Backup and trimming data idea

Our main table, tblLink, will have its primary key as foreign in a few other tables too and one of the tables will be tblMainData which over time will be millions of rows. We would like to maintain ...
0
votes
1answer
791 views

“Connection to host lost” using telnet to MySQL

I am trying to setup MySQL Workbench to manage a remote database and I keep getting "waiting for initial communication packet" error. So I try to telnet to the box on port 3306, I get in, but then I ...
1
vote
1answer
179 views

Storing user search keywords

I need to store search keywords in a database to analyse user needs. How efficient should my schema be? I'm thinking like this: CREATE TABLE SearchKeyword ( ID INTEGER PRIMARY KEY ...
3
votes
1answer
239 views

What is the right way to manage users data?

I'm trying to create a simple register login script with user profiles, I created a table with the following structure: +------------+---------------+------+-----+---------+----------------+ | Field ...
0
votes
1answer
91 views

Long running query

This is my long running query: select * from t_keyword where id in ( select rel.element_id from t_event event join t_event_element_rel rel on event.id = rel.event_id where ...
1
vote
3answers
475 views

Load spike in Mysql DB server

All of a sudden this morning I have a load spike on my server hitting up to 10. Which is unusual as it used to be below 1. Below is what I figure, in innodb engine status. Any thoughts if anything ...