background preloader

Programming

Facebook Twitter

Scale Fail (part 1) May 6, 2011 This article was contributed by Josh Berkus Let me tell you a secret. I don't fix databases. I fix applications. Companies hire me to "fix the database" because they think it's the source of their performance and downtime problems. I did a little talk about these anti-patterns at the last MySQL Conference and Expo. Trendiness "Now, why are you migrating databases? "Well ... our CTO is the only one at the weekly CTO's lunch who uses PostgreSQL.

Does this sound like your CTO? Scaling an application is all about management of resources and administrative repeatability. There's also another kind of trendiness to watch out for, it's the one which says, "If Google or Facebook does it, it must be the right choice. " Second, not everything that Google and Facebook did with their infrastructures are things they would do again if they had to start over. No metrics "Have we actually checked the network latency? " Scaling an application is an arithmetic exercise. Barn door decision making. Welcome to LWN.net. SQL Foreign Key. A foreign key is a column (or columns) that references a column (most often the primary key) of another table.

The purpose of the foreign key is to ensure referential integrity of the data. In other words, only values that are supposed to appear in the database are permitted. For example, say we have two tables, a CUSTOMER table that includes all customer data, and an ORDERS table that includes all customer orders. Business logic requires that all orders must be associated with a customer that is already in the CUSTOMER table. To enforce this logic, we place a foreign key on the ORDERS table and have it reference the primary key of the CUSTOMER table.

This way, we can ensure that all orders in the ORDERS table are related to a customer in the CUSTOMER table. In other words, the ORDERS table cannot contain information on a customer that is not in the CUSTOMER table. Unix system calls (1/2) Insert Data From One Table to Another Table – INSERT INTO SELECT – SELECT INTO TABLE « Journey to SQLAuthority. Following three questions are many time asked on this blog. How to insert data from one table to another table efficiently? How to insert data from one table using where condition to anther table? How can I stop using cursor to move data from one table to another table? There are two different ways to implement inserting data from one table to another table. I strongly suggest to use either of the method over cursor. Performance of following two methods is far superior over cursor. I prefer to use Method 1 always as I works in all the case. Method 1 : INSERT INTO SELECT This method is used when table is already created in the database earlier and data is to be inserted into this table from another table.

Reference : Pinal Dave ( SQL Server Downloads Like this: Like Loading...

Dotnet

Guide to Most Useful Bookmarklets for Chrome, Firefox, Safari, etc.