DEV Community

Cover image for What is online database driven websites?
mattiethomass
mattiethomass

Posted on

What is online database driven websites?

What is it for, how to manage it, and what does it have to do with site load speed? And then there are the so-called revisions, which add their own features when working. Let's look at all this from the outside, so that then you can skillfully handle the database of your site. At the same time let's find out how much time it takes to go to the database and bring back to the site the information found.

A short introductory paragraph

Any information on the site needs to be stored somewhere. This is an obvious fact. But the storage locations may be different. The first variant is right inside HTML or PHP file. This way is very often one. This is when you open a page in the admin panel to edit their information, but the page is empty inside. Not at all. But when you view the page on the site there is text, pictures, and other data.

The thing is that in this case the text and links to the images are added directly to the PHP file of the theme of the site. To change the page, you need to go to the hosting in the theme folder and edit the desired file.

The second option of data storage is more convenient and familiar. This is when you open a page in the admin panel, see all the data there and change them at ease. Refresh the page and everything is ready. In this scheme, the data is updated dynamically and is taken from the online database. Let's talk about it.

What is a database

Technically, this is a file with the extension ”.sql” (for a site on WordPress). Inside it has tables, which have rows. And already in the lines recorded data. This is where this data is taken for the output on the pages of the site. The main advantage of this scheme of data storage - all information is in one file. And so, it can be easily saved.

In addition to page information, the database contains a lot of service information. In general, an important file. To see a list of databases for your hosting account, see "Databases".

This is a list of bases. To go inside each one and see what is being done there, you can use the full access link - circled in red in the screenshot above. phpMyAdmin is a web application to manage databases. And the information inside it will be a little more unusual. Therefore, you can go there and look, but change something there - only if you know exactly what you do. Or have a backup copy of the database in hand.

What does this have to do with site load speed?

The connection here is the most direct. The smaller the database, the faster the information in it will be found for further display on the site. And vice versa. In addition, in addition to page content, the database also stores other, service information.

And this, first of all, is the data of all the site plugins. If you have a security plugin that records all user activity (failed login attempts, active sessions), then where does it store all that data? All in the same place, in the database. Only in a separate table.

The database stores all comments on the site, data of all registered users, all links, and site settings. In short, everything in general. Without the database, your site simply won't open. Instead, you get a blank screen with the phrase "Database connection failed". So, the more content and plugins are on the site, the bigger the database size is. And this means that over time the speed of the site may drop.

What are post and page audits?

Every time you change a page on the site and save it, WordPress creates a copy of the page with your changes. If 5 minutes later you remembered that you forgot to put a comma in the text and again change and save the page, another copy will be created.

On the one hand, this scheme is good. After all, if necessary, you can roll back to a previous version of the page. But on the other hand, you can create a lot of such copies. All of them, as you can imagine, are stored in the same database. And all this is not the best effect on the performance of the site.

Therefore, such copies should be deleted from time to time.

In addition to removing revisions, the plugin is good because it shows the size of each table in the database and its total size. And if after analyzing the database you see that some table has too many rows, you need to look closely - what is stored in this table and how it can be optimized.

What's the bottom line?

Yes, this whole database is a bit more complicated than editing pages in the site's admin panel. But it's still possible to figure it out. I highly recommend that you at least check the size of the database of your site. You can do this in hosting or through a plugin, whichever is more convenient. See there a lot of lines in some table - then there is reason to look into the causes and clean up there.

Top comments (0)