All versions of MySQL (not Microsoft SQL Server). Please also add a version-specific tag like mysql-5.7 if that is relevant to the question.

learn more… | top users | synonyms

0
votes
1answer
350 views

Type of Foreign Keys for a Dimensional Model Fact Table?

I've been reading about dimensional models, and in particular fact tables, but I haven't really seen one in action (i.e. the actual content), just diagrams of the table structures and column names ...
1
vote
0answers
189 views

problem installing mytop , need a up to date tools for monitoring mysql

so i'm trying to installl mytop to monitor the database i'm following this instruction : http://www.sohailriaz.com/how-to-install-mytop-a-top-clone-for-mysql/ when i try to install it with yum i get ...
0
votes
1answer
866 views

MySQL: all stored procedures deleted?

Started seeing some strange errors from dependent processes this morning. After some digging it appears that the file /mysql/proc.MYD is set to zero length. The file /mysql/db.MYD appears to be ...
1
vote
1answer
409 views

MySQL auto_increment delivers different primary key in MyISAM and InnoDB

I have a table with auto incremental primary key. If I want to change a row and add new rows I got different primary keys depending on engine MyISAM and InnoDB. The original table is: pk.. ...
2
votes
1answer
8k views

Not able to login on MySQL in AWS RDS using root

I am trying to connect my MySQL RDS from EC2. Under security groups I have made sure permissions are in place. $ mysql -h xxx.xyz.ap-southeast-1.rds.amazonaws.com -P 3306 -p Enter password: I am ...
0
votes
1answer
1k views

Calculating time spent on query cache lock

How can I calculate the total time my MySQL database is spending Waiting for query cache lock ? I've found two specific very simple tables that adding a SQL_NO_CACHE drastically improved the ...
0
votes
0answers
493 views

Stored procedure to replace a string in an entire database

I am trying to create a procedure to change a string in an entire database... after a lot of searching I have come up with this procedure, but it gives an error. The procedure is: BEGIN declare t, c ...
3
votes
1answer
1k views

Mysql slow select from a view

I would appreciate an approach with this problem, I have a lottery system in mysql, this system receives a lot of transaction per second.. a lot!. I need to check the total amount for each the number ...
1
vote
1answer
1k views

How does locking work in INSERT..ON DUPLICATE KEY UPDATE statements?

I am encountering deadlocks while trying to update multiple rows (a batch) using INSERT..ON DUPLICATE KEY UPDATE. Does MySQL lock all the rows in one batch or does it lock only the row it is updating ...
2
votes
1answer
87 views

Table Relationship cardinality

I am designing a database for my application, I got issue in implementing the following logic. A user may be a Vendor and also a Buyer. I have created a table for USER and created an another table ...
1
vote
0answers
187 views

Replication issue - CREATE SELECT alternative?

I've an MySQL 5.1 slave for our BI team. They need to make some CREATE SELECT with big select queries (several million lines). As CREATE SELECT is a DDL, if the replication attempts to update some ...
0
votes
1answer
918 views

mysql crashed, after start again, the new data lost, only old records of some day ago

I got a server restart, the mysql server seems crashed. After reboot, mysql database filled of old data for bug tracker. Do you know how to fix this? mysql error log as below 131027 15:29:19 ...
2
votes
1answer
684 views

pt-online-schema-change tool will work for existing triggers for a table?

I have a table name "user" ,I have tried to do partition the table and it was having a trigger already. When i have tried to alter the table with pt-online-schema-change.It was showing the below ...
2
votes
1answer
149 views

Should I be concerned about excessive Com_change_db commands?

I installed MONyog recently to check for problems on a MySQL server that I admin. Most of the information was useful and helpful, but there's one warning I am not sure is worth fixing. It reports ...
5
votes
2answers
5k views

MySQL, foreign key, can't create table error 150

UPDATE: Sorry, it was because i forgot to add UNSIGNED attribute to the lang_id column. Original: I'm trying to create a table with foreign key in MySQL. I get this error: #1005 - Can't create table ...
0
votes
2answers
160 views

MySQL: Does the “length” setting affect table size in bytes?

Regarding setting the length of allowable characters for a field (11) in the example: Does this number affect the size of the table? For example, I want to create a char type column and I only ...
1
vote
1answer
618 views

Using coalesce on an index column

Does doing a COALESCE on an indexed columns in a WHERE clause e.g. WHERE COALESCE(table1.indexed_column, '9999-01-01') > table2.other_date_column affect indexing in a bad way? I think that it ...
0
votes
0answers
213 views

mysqldump & upload to mysql speed impact due to SSD and innoDb?

I am testing an AWS Medium Instance with CentOS (AWS AMI) and comparing it with Hetzner's EX40-SSD (http://www.hetzner.de/hosting/produkte_rootserver/ex40ssd). Software setup on both is comparable( ...
0
votes
1answer
108 views

MySQL High I/O. Wrong configuration?

Since I switched from MyISAM to InnoDB I have a high I/O. The writes is a flat line, it seems there is a limit for them. This is my current mysql configuration: [mysqld] bind-address = 127.0.0.1 ...
0
votes
3answers
9k views

How much RAM is required for 5000 concurrent users MySQL

Going by this : When should I think about upgrading our RDS MySQL instance based on memory usage? for max_connections to be set at 5000 concurrent users,how much should be the RAM capacity be ? If ...
3
votes
2answers
2k views

MySQL - Add index to low cardinality text column?

I'm working on project where an enum column is being converted into a text column (I cannot change this). The cardinality of the column is low (7 unique values). Would I gain a performance increase by ...
3
votes
3answers
1k views

Encrypt MySQL database on a Linux VPS?

I'm working on a rails app for our church, which stores some fairly sensitive information about our people in a MySQL database. We have our own windows server running Hyper-V so the original ...
0
votes
0answers
156 views

Populate the columns of one table with the records of another

I have one table, FRUIT, describing some measurements that I make: ID Tag Amount Units 1 A 75 Apples 2 B 23 Bananas I would like another table, HISTORY, that tracks the ...
0
votes
1answer
75 views

Optimize query with similar fields

I have the below schema, fields owner_id,billing_id,tech_id,admin_id on carts table are pointing to contacts table. As you can see from the query result I have to JOIN for each field .Is there a way ...
2
votes
3answers
8k views

Database design to track student attendance

I was having a doubt regarding the design of a database table to track students' attendance. Currently, my table students have atleast 4000 students. Creating a database for attendance to track their ...
0
votes
1answer
2k views

MYSQL How do I query to show data in separate columns from one field?

sorry if my question is worded poorly, my SQL vocabulary is very poor. So basically, suppose I had a table as so: CREATE TABLE MYTABLE { item_id int AUTO_INCREMENT PRIMARY KEY, item_name ...
0
votes
1answer
42 views

How to create new column with value from other table

I have a table called 'menus': menu_id | sort | page_id | parent_page_id ---------|------|---------|---------------- 1 | 0 | 1 | NULL 1 | 1 | 2 | 1 1 | 2 | ...
12
votes
2answers
2k views

Fastest way to change a 600GB table indexed key datatype from INT to BIGINT

I need to change a datatype from INT to BIGINT in a 600GB MySQL table. The column has a unique index. I might be good with unsigned INT, but I assume changing to that or BIGINT will be pretty much ...
0
votes
1answer
65 views

Constraint referencing multiple tables [duplicate]

I believe my problem is something similar to this but I am not really sure. I am not even sure my title is on topic. Using mysql. I have the following ACL design for a website: ### tools id name ### ...
0
votes
1answer
202 views

Approximation of table size for MySQL cluster

I want to make some approximation of table size for MySQL cluster. Please read my reasoning and tell me, if I am right or am I making mistake somewhere. I have simple table with PK (int) and ...
3
votes
2answers
3k views

Does using LIMIT improve the performance and is it noticeable?

I want to understand the following. Assume that I have a complicated query with let's say a join of 5 tables a group by summations and order by. Letting aside any optimizations to the query itself ...
0
votes
2answers
795 views

MySQL Error: FUNCTION LEVENSHTEIN already exists

I've got an ExpressionEngine database and I exported a couple of tables from it, then dropped those tables. When I try to re-import the tables in PHPMyAdmin, I get this error: SQL query: -- -- ...
0
votes
2answers
125 views

Trigger calls and application code

When a trigger is set on a table does the application code wait for the original statement and the trigger to execute before resuming or just the original statement? Consider application code to be ...
0
votes
1answer
278 views

How to make slave is in sync with master in tungsten replication?

we are using Tungsten master to slave replication in MySQL. we have configured this setup very long back. from last week onwards slave is in lagging with master around 5 to 10 binary files. we have ...
0
votes
1answer
57 views

Build a simple query and relationship table

This is my first post here. Thanks for having me! I have two questions for a table I'm building into my mysql database. Question 1: I have a need to input an artist name and the result/select be a ...
0
votes
0answers
278 views

In mySQL possible to change auto-increment ids that have huge gaps and if so how?

I am importing a 50 table relational database (I'm not a dba) with 250,000+ records in most of the tables, yet the auto increment is off in most tables, some for example showing the last ID at 5 ...
2
votes
2answers
562 views

Slow query responce on different mysql versions, percona, MariaDB

LEFT JOIN is supposed to be faster than a NOT IN query. This is what I've read online. But practically, this seems to be opposite. I have the following query here, INSERT IGNORE INTO callrequests ...
5
votes
3answers
704 views

Just how much is a query supposed to slow down the whole system?

This is similar to my earlier question but more generic. I have a system with 16GB of memory, 16 cores, supposedly quality hard drives, RHEL 5, MySQL 5.0.x. Yes, I know, we're working on upgrading ...
0
votes
1answer
102 views

Not Equal Operation is not working

I have two tables 1st Table : center (2 columns) +-----------------------------------+ |id | company_name | +-----------------------------------+ |2 | Skytel Outsourcing Pvt. Ltd. ...
1
vote
2answers
241 views

Filesort while using primary key for orderby

I have been breaking my head for the past two days now for this. CREATE TABLE `clients` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `guarantor_name` varchar(50) NOT NULL, ...
1
vote
0answers
887 views

multiple child records in a single row by join

I have one master table (teacher) structured like teacherId Name Class 1 Praveen 10 2 John 9 and having a child table (student) structured like studentId ...
2
votes
2answers
1k views

MySQL Cluster - Got error 1601 'Out extents, tablespace full' from NDB

I am trying to do some tests on MySQL Cluster. I am creating my database using following commands: CREATE DATABASE test1; use test1; CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' ENGINE = NDB; ...
3
votes
3answers
25k views

Data Truncated for Column

DECLARE float_one, float_two, my_result NUMERIC(7,2) my_result = CONVERT(float_one/float_two, DECIMAL(7,2)); In this mysql query, I do this type of operation in a stored procedure, but the Linux ...
1
vote
2answers
52 views

Convert to JOIN [duplicate]

I have a correlated sub query, which is taking 16 Minutes to execute how can i convert it to join or optimize it. SELECT SSF.SM_StockCode, SSF.ST_ItemSize FROM Stock AS SSF WHERE SSF.SM_StockCode = ...
3
votes
1answer
8k views

Mysql Slave replication: Need to determine where replication left off to start slave in correct location

Idiotically I rebooted a machine that is used as a mysql slave without running STOP SLAVE, FLUSH TABLES first. I had thought mysql automatically handles all of this during a machine reboot, but ...
4
votes
3answers
763 views

Improve Query Performance over Large Dataset

As part of a daily cron job, I need to run a query that processes a whole lot of data. This data is related to the visitors coming to a website, and updating the data with what we have captured ...
0
votes
1answer
894 views

Replication - Binary log parsing(Tableid generation, ON DELETE CASCADE handling, Changed columns for update event)

I am using MySQL 5.5 with InnoDB engine. I have set binlog format as row-based replication. I have some doubts regarding replication: 1) How is the tableID generated? Is it stored somewhere? 2) ...
0
votes
0answers
187 views

MySQL Slave with erratic Read_Master_Log_Pos during binlog rotation?

I have two mysql servers setup with default my.cnf config apart from server-id's and enabling binlogs on masters. Replication is setup and working and i have a simple bash scrip on master feeding in ...
1
vote
0answers
53 views

Optimizing a query using derived tables [duplicate]

As part of a daily cron job, I need to run a query that processes a whole lot of data. This data is related to the visitors coming to a website, and updating the data with what we have captured ...
-1
votes
2answers
2k views

How do I connect to a database with a blank password using a shell script?

## connect to mysql and source backup file ## USER="root" PASS="" mysql -u$USER -p$PASS database_name < backup.sql Above is my shell script which I used to source database but still its asking ...