MySQL

You are currently browsing the archive for the MySQL category.

DBAs facing the problem of corporate data explosion have an excellent new tool to help them in the MySQL 5.0 Archive storage engine. Whether it’s a data warehousing, data archiving, or data auditing situation, MySQL Archive tables can be just what the doctor ordered when it comes to maintaining large amounts of standard or sensitive information, while keeping storage costs at a bare-bones minimum.

via MySQL :: The MySQL 5.0 Archive Storage Engine.

Should probably investigate using ARCHIVE storage for the multi-year history tables

MySQL replication can stop if slave fails to execute SQL statement from the binary log. From that moment, slave prints last error and waits for replication recovery. If master has consistent snapshot, then is only necessary to re-point slave to the new master position. It can be done with change master to or sql_slave_skip_counter.

via MySQL replication recovery.

However, sometimes you want to apply binary logs to a MySQL instance, without having those changes applied to the binary logs themselves. One option is to restart the server binary logging disabled, and after the load is finished, restart the server with binary logging re-enabled. This is not always possible nor desirable, so there’s a better way, that works in at least versions 4.1 and up

via Applying binary logs without adding to the binary log | The Pythian Blog.

SET SESSION sql_log_bin=0;

Somebody asked in Freenode the other day how to get their data out of MySQL into a specific XML format.

Both mysqldump and the mysql client have –xml options. The output from the cli looks like this:

via A Little Noise » Blog Archive » mysql’s –xml and some XSLT.

Tags:

Today a customer mentioned reordering a MyISAM table to get rid of fragmentation. I asked them to clarify what they meant by reordering, assuming that they were running an OPTIMIZE or a NULL ALTER TABLE operation and they said that they use ALTER TABLE t1 ORDER BY f1, f2, f3,..etc;

via Things you manage to miss – ALTER TABLE .. ORDER BY – The Soapbox.

Tags: ,

Following Restore one table from an ALL database dump and Restore a Single Table From mysqldump, I would like to add my own thoughts and comments on the subject.I also wish to note performance issues with the two suggested solutions, and offer improvements.

via On restoring a single table from mysqldump | code.openark.org.


face@mac:V:150 $ sed -n “/^– Table structure for table \`mx_categories\`/,/^– Table structure for table/p” wordpress_2009-12-02_02h15m.Wednesday.sql
– Table structure for table `mx_categories`

DROP TABLE IF EXISTS `mx_categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mx_categories` (
`cat_ID` int(4) NOT NULL AUTO_INCREMENT,
`cat_name` varchar(55) NOT NULL DEFAULT ”,
`category_nicename` varchar(200) NOT NULL DEFAULT ”,
`category_description` text NOT NULL,
`category_parent` int(4) NOT NULL DEFAULT ’0′,
PRIMARY KEY (`cat_ID`),
UNIQUE KEY `cat_name` (`cat_name`),
KEY `category_nicename` (`category_nicename`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;


– Dumping data for table `mx_categories`

LOCK TABLES `mx_categories` WRITE;
/*!40000 ALTER TABLE `mx_categories` DISABLE KEYS */;
INSERT INTO `mx_categories` VALUES (1,’General’,'general’,”,0),(2,’Unix Notes’,'unix-notes’,”,0),(3,’AppleScript Notes’,'applescript-notes’,”,0),(4,’Misc Notes’,'misc-notes’,”,0),(5,’System Software Notes’,'system-software-notes’,”,0),(6,’Applications Notes’,'applications-notes’,”,0),(7,’Web Serving’,'web-serving’,”,0),(8,’Utilities Notes’,'utilities-notes’,”,0);
/*!40000 ALTER TABLE `mx_categories` ENABLE KEYS */;
UNLOCK TABLES;


– Table structure for table `mx_commentmeta`

With a high volume of data, this sounds like a table partitioned on day boundaries (in MySQL 5.1). See Sarah’s blog and her links for a quick ramp-up on time-based table partitioning (http://everythingmysql.ning.com/profiles/blogs/partitioning-by-dates-the). One great benefit of table partitioning is that you can drop a partition to lose millions of rows in one quick statement, much faster than deleting millions of rows. Sort of like a partial TRUNCATE TABLE.

via Glynn’s Thoughts on Databases: Rolling Time-based Partitions.

Tags:

The existence of number tables has always been a little pain. Yes, they’re very, very simple, but they need to be there. So if you just need to script some SQL query, you may find that you need to create such tables. Ummm… this means you need to have privileges (at least CREATE TEMPORARY and INSERT, if not CREATE).

via Generating numbers out of seemingly thin air | code.openark.org.

Tags:

In a SQL server, the data tables sit on disk. Indexes provide a means for the server to find a particular row of data in the table without having to search the entire table. When the entire table has to be searched, it's called a table scan. Most often, you want only a small subset of the data in the table, so a full table scan wastes a lot of disk I/O and therefore time.This problem is compounded when data must be joined, because many more rows must be compared between the two sides of the join.

via Tuning LAMP systems, Part 3: Tuning your MySQL server.

Tags: , , ,

SET SQL_LOG_BIN=0;

via MySQL :: Re: restore file without binary logging.

Tags:

« Older entries