MySQL

You are currently browsing the archive for the MySQL category.

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:

FROM_UNIXTIME


select user_id, username, from_unixtime(user_regdate) from phpbb3_users where user_lastvisit = 0 order by user_regdate;

Tags: ,

The REPLACE [INTO] syntax allows us to INSERT a row into a table, except that if a UNIQUE KEY (including PRIMARY KEY) violation occurs, the old row is deleted prior to the new INSERT, hence no violation.

Sounds very attractive, and has a nice syntax as well: the same syntax as a normal INSERT INTO’s. It certainly has a nicer syntax then INSERT INTO … ON DUPLICATE KEY UPDATE, and it’s certainly shorter than using a SELECT to see if a row exists, then doing either INSERT or UPDATE.

via code.openark.org » Blog Archive » REPLACE INTO: think twice.

I've been asked to make some reports recently for some people in my company.

Almost all of them are quite heavy and hit the database pretty hard.

The thing is that these reports are usually generated once or twice a month, but they process a year's worth of data. Every time they are generated, they really upsets my poor production MySQL database.

I was thinking if there maybe could be a better way to just save the processed data in a table and update it every now and then.

via When pet projects bite back!: Reporting SpeedUp Trick.

PURGE MASTER LOGS TO ‘mydb-bin.0023′;

Then the binlog before ‘mydb-bin.0023′ will be deleted.

You may also do this:

PURGE MASTER LOGS BEFORE ’2008-06-13 08:00:00′;

Tags:

Putting the MySQL information_schema to Use

The MySQL information schema database was introduced in the September issue of the newsletter. We’ve seen that the information schema allows us to access metadata in a much more flexible way than the MySQL specific SHOW commands. We owe this to the fact that the information schema allows us to query and format metadata using arbitrary SELECT statements. Let’s explore this feature, and try to put that to good use

MySQL :: MySQL Enterprise for Amazon EC2:

Amazon EC2 is a web service that allows organizations to right size their computing capacity on demand using Amazon’s proven computing environment. Using MySQL Enterprise for Amazon EC2, developers can cost-effectively deliver web-scale database applications in the “cloud”, fully backed by the database experts at MySQL. Amazon EC2 and MySQL are a great fit for organizations that want to reduce the capital expenditures and operating costs required to build out and run their IT infrastructure. The benefits of MySQL Enterprise for Amazon for EC2 include:

« Older entries § Newer entries »