Tag Archives: mysql

Context aware MySQL pools via HAProxy

At GitHub they use MySQL as their main datastore. The setup is a typical “single-writer-multiple-readers” design. They loadbalance between server pools using HAProxy, with some cleverness built in: Instead [of checking whether a MySQL server is live with mysql-check], we … Continue reading

Elsewhere , , , Leave a comment

Why Uber Engineering Switched from Postgres to MySQL

Postgres served us well in the early days of Uber, but we ran into significant problems scaling Postgres with our growth. In this article, we’ll explore some of the drawbacks we found with Postgres and explain the decision to build … Continue reading

Elsewhere , , , Leave a comment

MySQL behaviour you should be aware of

I suggest changing the syntax for NOT NULL to “NOT” NULL. If you’re not checking all values in your code logic (viz. PHP code or something like that) before attempting to perform the database manipulation you can fix it by … Continue reading

Elsewhere , , Leave a comment

Storing MD5 values

A common occurrence I have noticed in MySQL apps is that MD5 values are stored as 32 byte values rather than 16. Just to ‘rehash’, an MD5 value is a 16 byte hexadecimal value, typically used as a unique fixed-length … Continue reading

Elsewhere , , Leave a comment

WebScaleSQL

WebScaleSQL is a collaboration among engineers from several companies that face similar challenges in running MySQL at scale, and seek greater performance from a database technology tailored for their needs. Those “several companies” are Facebook, Google, LinkedIn, and Twitter. And … Continue reading

Elsewhere , Leave a comment

Backup local MySQL Databases

Nice script by Xavez. Put it in a daily cronjob if you like, or extend it to copy the backup to another machine: #!/bin/bash # Path to where you want to backup mysql databases. opath=/Users/username/Sites/Backups/mysql/ # Local mysql details. Make … Continue reading

Elsewhere , , Leave a comment

node-orm2 — Node.js Object Relational Mapping

ORM Package for Node.js. Works with MySQL, PostgreSQL and SQLite. var orm = require(‘orm’); orm.connect("mysql://username:password@host/database", function (err, db) { if (err) throw err; var Person = db.define(‘person’, { name : String, surname : String, age : Number, male : Boolean, … Continue reading

Elsewhere , , , Leave a comment

SQL Fiddle

Think of jsFiddle, but then for databases: Create schemas and run queries on them. Microsoft SQL, MySQL, Oracle, and PostgreSQL supported. SQL Fiddle →

Elsewhere , , , , , 1 Comment

MySQL: Get next AUTO_INCREMENT value from/for table

Note to self: To get the next auto_increment value from a table run this query: SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = "databaseName" AND TABLE_NAME = "tableName" Don’t forget it (again).

Elsewhere , , 22 Comments