# Five mistakes beginners make when working with databases

DevFeed: [Five mistakes beginners make when working with databases](<https://devfeed.tech/articles/five-mistakes-beginners-make-when-working-with-databases-41189.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2016/06/07/five-mistakes-databases/>)

Author: Map

Published: 2016-06-07T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [Databases](<https://devfeed.tech/topics/databases.md>), [Amazon S3](<https://devfeed.tech/topics/amazon-s3.md>), [Development](<https://devfeed.tech/topics/development.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [web applications](<https://devfeed.tech/topics/web-applications.md>)

Tags: [amazon-s3](<https://devfeed.tech/tags/amazon-s3.md>), [beginners](<https://devfeed.tech/tags/beginners.md>), [databases](<https://devfeed.tech/tags/databases.md>), [development](<https://devfeed.tech/tags/development.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

A developer article discusses database practices that beginners may adopt, including storing images in database fields and using limit/offset pagination. It recommends storing image URLs for images hosted on services such as Amazon S3 and notes scalability and consistency concerns with limit/offset pagination.

## Source excerpt

When you start out as a developer there's an overwhelming amount of things to grasp. First there's the language itself, then all the quirks of the specific framework you're using,and after that (or maybe before) we'll throw front-end development into the mix, and somewhere along the line you have to decide to store your data somewhere. Early on, with so many things to quickly master, the database tends to be an after-though in application design (perhaps because it doesn't make an impact to end user experience). As a result there's a number of bad practices that tend to get picked up when working with databases, here's a rundown of just a few. 1. Storing images Images don't belong in your database. Just because you can do something, it doesn't mean you should.Images take up a massive amount of space in databases, and slow applications down by unnecessarily eating your database's IO resources. The most common way this mistake occurs is when new developers base64 encode an image and store it in a database large text/blob field. The better approach is to upload your images directly to a service like Amazon S3, then store the image URL (hosted by Amazon) in your database as a text field. This way, each time you need to load an image, you need to simply output the image URL into a valid <img> tag. This will greatly improve website responsiveness, and generally help scale web applications. 2. Limit/Offset Pagination is extremely common in a number of applications.As soon as you start to learn SQL, the most straight-forward way to handle pagination is to ORDER BY some column then LIMIT the number of results returned, and for each extra page you'll OFFSET by so many records. This all seems entirely logical, until you realize at any moderate scale: The load this exerts on your database will be painful. It isn't deterministic, should records change as the user flips between pages. The unfortunate part is: pagination is quite complex, and there isn't a one-size-fits-all soluti