MySQL: Count occurrences of distinct values in a column
What i want to do is : example db id name —– —— 1 Mark 2 Mike 3 Paul 4 Mike 5 Mike 6 John 7 Mark expected result name count —– —– Mike 3 Mark 2 Paul 1 John 1
What i want to do is : example db id name —– —— 1 Mark 2 Mike 3 Paul 4 Mike 5 Mike 6 John 7 Mark expected result name count —– —– Mike 3 Mark 2 Paul 1 John 1
SELECT <…> FROM A.table1 t1 JOIN B.table2 t2 ON t2.column2 = t1.column1;
The idea behind partitioning isn’t to use multiple servers but to use multiple tables instead of one table. You can divide a table into many tables so that you can have old data in one sub table and new data in another table. Then the database can optimize queries where you ask for new data … Read more
The busiest file in the InnoDB infrastructure is /var/lib/mysql/ibdata1 This file normally houses many classes of information (when innodb_file_per_table is 0) Table Data Table Indexes MVCC (Multiversioning Concurrency Control) Data Rollbacks Segments Undo Tablespace Table Metadata Many people create multiple ibdata files hoping for better diskspace management and performance. It does not help. Unfortunately, OPTIMIZE TABLE against … Read more
Here we will help you to set up Master-Master replication between MySQL servers. In this setup if any changes made on either server will update on an other one. Setup Details: Master-1: 10.0.10.12 Master-2: 10.0.10.18 Database: empmaster Step 1. Set Up MySQL Master-1 Server Edit MySQL configuration file and add the following lines under [mysqld] section. Restart … Read more
ALTER IGNORE TABLE `cdr` ADD UNIQUE(`uniqueid`)
If you omit the ENGINE option, the default storage engine is used. Normally, this is MyISAM, but you can change it by using the –default-storage-engine server startup option, or by setting the default-storage-engine option in the my.cnf configuration file. You may also want to change the default storage engine just for the current session. You can do this by setting the storage_engine variable: SET storage_engine=INNODB; … Read more
MYISAM: MYISAM supports Table-level Locking MyISAM designed for need of speed MyISAM does not support foreign keys hence we call MySQL with MYISAM is DBMS MyISAM stores its tables, data and indexes in diskspace using separate three different files. (tablename.FRM, tablename.MYD, tablename.MYI) MYISAM not supports transaction. You cannot commit and rollback with MYISAM. Once you … Read more
Here we will help you to setup master-slave replication between MySQL servers. Setup Details: Master Server: 10.0.10.12 Slave Server: 10.0.10.18 Database: empmaster 1. Setup MySQL Master Server Create an mysql account on Master server with REPLICATION SLAVE privileges to which replication client will connect to master. Block write statement on all the tables, so not … Read more