Almost everyone knows the term "database", even people with little connection to IT. The idea is fairly intuitive: data can be stored in one place and so form a base, or a catalog of data. It doesn't have to be digital. Most of us know places where documents, files and card indexes are kept, and those are databases too, although rather primitive and "manual" ones. So it seems everyone should be familiar with the term, but is that really the case, and do we use it correctly?

Many phrases are tied to databases, and they are sometimes used wrongly. This usually comes from haste and the "you know what I mean, so why ask" attitude, but it turns out that not everyone knows what should stand behind certain terms and how to understand them. Hence this text, which works as a kind of glossary for conversations about databases, both in a business setting and a strictly technical one.

What is a database?

Let's go back to the beginning of this text: a database is a collection of information gathered in a systematic and organized way. It is a general concept, although most often it is identified with a database instance, meaning a specific occurrence of a database (it isn't quite that simple, more on that later) used by a given IT system or application. For example, a particular blog (like this one) has its own database, Twitter has its own, Onet.pl has its own, and so on. A service can have several databases, and several services can share one. Every database is a living organism: data is read from it, and new data can be added to it all the time.

That is why, formally, MySQL or a downloaded data file on your computer is not a database. In practice people sometimes say it that way as a shortcut. Usually this happens either in internal conversations between technical people, who know what is meant anyway, or when talking to a layperson so that they can at least roughly understand what the IT people intend. When explaining specialized topics, it is sometimes good to "lie" a little at first to get a connection going, and only later "unlie" to make what was understood even clearer. And that second part is exactly what I'm doing in this text.

What is a database management system (DBMS)?

A database doesn't exist in a vacuum. It is served by a program, or rather a whole database engine and a specific mechanism that acts as the storage and the interface for accessing information. That is the database management system, or rather the management system for databases, because one system can of course hold many databases for different applications.

In general, a DBMS is either relational (SQL) or non-relational (NoSQL). The former have an ordered structure of tables (called relations), and the links between them not only tie the data together but also help check its correctness. This is the most popular way of handling databases, and it is how the well-known MySQL, PostgreSQL and Oracle work. All of them provide their own implementation of the SQL query language (Structured Query Language), which lets users and applications access and modify both the information and the schema. So SQL isn't a database either. It is the language we use to talk to one.

Non-relational systems, as the name says, don't rely on relations but on much looser structures for storing information. They aren't a uniform group. There are document databases (MongoDB), column-family databases (Apache Cassandra), key-value stores (Redis) and graph databases (Neo4j). They differ from SQL databases not only in how you communicate with them (they have their own languages) and in structure, but also in performance in specific situations and in scalability.

Remember when I said it's sometimes worth "lying" first and "unlying" later? I did it in this paragraph too, because a database management system is not necessarily the same thing as a database engine. For example, the well-known MySQL has two: InnoDB (the default, relational one) and the older MyISAM. For most systems, though, this makes little difference, and here merging the two terms is especially understandable.

What is a database schema?

I mentioned that relational databases are built from tables, the links between them and other helper elements. Arranging the relations well matters a lot, both for the consistency of the stored information and for the performance of everything that uses the database later. So you need to think carefully about which tables are really needed and how the data should be organized. In other words, you need to design a database schema, and that is exactly what it is. It is the skeleton that records (also called tuples) rest on, and that is used to handle them with SQL queries. The art of designing schemas is a very broad topic, often taught over whole semesters at university, but above all practiced project after project and adapted to the situation at hand.

In short, a database schema is a database without any data, only with information about the structure of the tables. That is why, when you make a backup with the right tools, you can usually choose between backing up the schema alone or the schema together with the data.

What is a database image?

We said that a database is a "living" thing in which data can change. Failures happen, and sometimes you need to run operations on another computer or server, so making backups of the database is valuable. That means saving a specific state of the data at a given moment in time, most often as a file. That is exactly what an image, also called a copy, is.

What is a database instance?

Here we have to return to scaling, that is, preparing an IT system so that it can be "spread" across several servers. This applies to the database too, which can be replicated: copies can be created when needed, and they synchronize with each other. This has less to do with performance than with resilience to failures and the ability to restore data. Each of these copies is a separate database instance, that is, an "occurrence" of it.

The word "instance" is widely used throughout computing. Most programmers probably associate it with object-oriented programming, where an object is an instance of a class (a concrete example of using a given blueprint, so to speak). If you have the "Calculator" program running three times on your computer, you have three instances of it. It's the same with applications on a server, and with databases. Of course, in most cases there is only one instance of a given database, but for huge systems or those of strategic importance it is no longer so obvious.

What is a data warehouse?

Most applications use databases in the so-called OLTP, or transactional, model. Every write session to the database is a transaction, an uninterrupted (atomic) process that ends with everything saved or nothing saved. Again, this is a huge topic, but the gist is that it is the standard usage for systems with a lot of data, though not an enormous and fast-growing amount. You could say that 99% of the websites you use on the Internet rely on OLTP.

It's different with OLAP, the analytical model, which is the basis of a data warehouse. These are databases too, but colossal ones, constantly fed with gigantic amounts of data, and their mechanisms aren't designed for everyday, live use. Instead, OLAP systems focus on providing methods for building analyses and reports and for finding patterns that can help, for example, in designing a sales model. Two databases can of course exist side by side: an OLTP one for the normal use of the application, and an OLAP one where data is "set aside" for further analysis.

Can a database be called a data catalog?

In theory yes, but in practice it is rare to hear these terms used interchangeably. In design, the word "catalog" is more often associated with a list of possible options to choose from in a given field. For example, if a system stores clients and we want to analyze where they came from, we should record that information, but to keep later reporting sensible, we should also create a catalog of possible client sources. I mention this mostly for completeness: by definition, a "base" suggests something bigger.

Summary

Today's article was more about terminology, and I hope it made some readers aware of the meaning of phrases they hadn't thought about before, even though they came across them now and then. If so, I'm all the happier. Even if not, it is worth organizing and refreshing this kind of knowledge from time to time, because it keeps coming in handy when we want to communicate well, both inside an IT team and with clients.

Best regards and thank you, Jakub Rojek.