We programmers keep cargo culting these wrong ideas. Recently, we said "NO" to Venn diagrams. Today we're going to say no to surrogate keys. The surrogate keys vs. natural keys non-debate is one of the most overheated debates in data architecture, and I don't get why everyone is so emotional. Both sides claim to hold … Continue reading Say NO to Excessive Use of Surrogate Keys if Performance Really Matters to You
"Challenge accepted" said Tagir Valeev when I recently asked the readers of the jOOQ blog to show if the Java JIT (Just-In-Time compilation) can optimise away a for loop. Tagir is the author of StreamEx, very useful Java 8 Stream extension library that adds additional parallelism features on top of standard streams. He's a speaker … Continue reading The Java JIT Compiler is Darn Good at Optimization
It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to remove. - Antoine de Saint Exupéry in Terre des Hommes As SQL developers, we keep adding more and more indexes to our tables. Every time we run new queries that are potentially slow, a … Continue reading How to Know if a Given Index Can be Dropped
A lot of people use SQL constraints mainly to enforce data integrity, and that's already a very good thing. A UNIQUE constraint, for instance, makes sure that there is at most one instance of any possible value (or tuple, in the case of a composite constraint) in a table. For instance: CREATE TABLE x ( … Continue reading How Adding a UNIQUE Constraint on a OneToOne Relationship Helps Performance
A recent Tweet by Aaron Bertrand (whom you've certainly encountered on Stack Overflow) has triggered my interest https://twitter.com/AaronBertrand/status/752537591392657408 Indeed, few people I've met and who've visited my SQL masterclass have heard about the ANY and ALL quantifiers, which you can use in SQL, let alone used them on a regular basis (or ever used them … Continue reading Quantified Comparison Predicates – Some of SQL’s Rarest Species
Catchy headline, yes. But check out this Stack Overflow question by user Mike: (I'm duplicating it here on the blog, as it might be deleted soon) It's a pretty open ended question. I'll be starting out a new project and am looking at different ORMs to integrate with database access. Do you have any favorites? … Continue reading “What Java ORM do You Prefer, and Why?” – SQL of Course!
In recent times, there have been a couple of tremendously popular blog posts explaining JOINs using Venn Diagrams. After all, relational algebra and SQL are set oriented theories and languages, so it only makes sense to illustrate set operations like JOINs using Venn Diagrams. Right? Google seems to say so: Everyone uses Venn Diagrams to … Continue reading Say NO to Venn Diagrams When Explaining JOINs
A recent article about various ways to implement structural pattern matching in Java has triggered my interest: http://blog.higher-order.com/blog/2009/08/21/structural-pattern-matching-in-java The article mentions a Scala example where a tree data structure can be traversed very easily and neatly using Scala's match keyword, along with using algebraic data types (more specifically, a sum type): def depth(t: Tree): Int … Continue reading How Functional Programming will (Finally) do Away With the GoF Patterns