<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/you-should-stop-using-booleans-in-your-database-i456f8q6r" -->

---
title: You should stop using booleans in your database | daily.dev
description: Argues against using boolean fields in databases, suggesting datetime fields as a better alternative for tracking state changes. The post acknowledges this is...
canonical: https://daily.dev/posts/you-should-stop-using-booleans-in-your-database-i456f8q6r
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: You should stop using booleans in your database | daily.dev
og:description: Argues against using boolean fields in databases, suggesting datetime fields as a better alternative for tracking state changes. The post acknowledges this is...
og:url: https://daily.dev/posts/you-should-stop-using-booleans-in-your-database-i456f8q6r
og:image: https://api.daily.dev/og/posts/i456F8Q6R.png
og:image:alt: You should stop using booleans in your database
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# You should stop using booleans in your database

**[Laravel Dev](https://daily.dev/sources/laraveldev)** · [@sam7work](https://daily.dev/sam7work) · 1 min read · 90 upvotes · 22 comments

## Summary

Argues against using boolean fields in databases, suggesting datetime fields as a better alternative for tracking state changes. The post acknowledges this is a controversial stance and notes that some truly binary conditions may still require boolean representation, but emphasizes that many boolean use cases can be better modeled with temporal data that captures when changes occurred.

## Content

a bit of controversy for Monday , to get you going [video here](https://www.youtube.com/watch?v=ij5vpL9YDEc) this is obvioosly a bigger question than the title lends to.. , the argument is , use datetime, there are many uses of a boolean that can not be modelled properly by a datetime , some things are truly binary true / false that doesn't depend on known time and don't stay that way

## Community discussion

Top comments from developers on daily.dev.

**@traustitj** · 94 upvotes

> This is a very silly video to say the least. To use a datetime instead of boolean? That is simply WTF. Like in his example, a simple todo app, having Done as a datetime is fine, unless you want to toggle it. A better option would be to use a byte or even int as Done, and have a datetime for UpdatedAt, or have another log table for simply events which you then have a one to many relations.
> Using a byte or even int is perhaps better than a boolean, you either have 0 or anything that isn't zero. Having a datetime for fields like IsDeleted, IsHidden and many other cases is simply stupid, because...

**@maurcioandrcinelli** · 9 upvotes

> while I have advocated for this for a long time, databases struggle with indexing and querying when most rows have it NULL.
> Nowadays I use a combo od datetime field + autogenerated column that is boolean purely for queries that test if something was done, not when

**@crossplatform** · 9 upvotes

> Does "You should stop using booleans in your database" mean we should use char data type with 'Y' or 'N' constraint?

**@axelhowind** · 4 upvotes

> DateTime instead of boolean? WTF? You either need one or the other. Which one you need is defined by the requirements that you have. If you don’t know what the requirements are, you are either making the second step before the first (i .e., when you are a single developer), or should throw this back to the person who wrote down the requirements (if you work in a team/company) and tell them to do their job right the next time.

**@zx8086** · 3 upvotes

> Vibe Database-ing !

---

Tags: [#database](https://daily.dev/tags/database), [#backend](https://daily.dev/tags/backend), [#sql](https://daily.dev/tags/sql)

[View this post on daily.dev](https://daily.dev/posts/you-should-stop-using-booleans-in-your-database-i456f8q6r)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/you-should-stop-using-booleans-in-your-database-i456f8q6r","headline":"You should stop using booleans in your database","text":"Argues against using boolean fields in databases, suggesting datetime fields as a better alternative for tracking state changes. The post acknowledges this is a controversial stance and notes that some truly binary conditions may still require boolean representation, but emphasizes that many boolean use cases can be better modeled with temporal data that captures when changes occurred.","url":"https://daily.dev/posts/you-should-stop-using-booleans-in-your-database-i456f8q6r","datePublished":"2025-08-05T07:05:05.405Z","dateModified":"2025-09-10T15:28:10.015Z","author":{"@type":"Person","name":"Sam","url":"https://daily.dev/sam7work","image":"https://lh3.googleusercontent.com/a/ACg8ocJGz1oRsDNA5jHaL8S_Dm_S69r5oVuMT_253w26IC3wacnjq1U=s96-c","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":7640}},"image":"https://media.daily.dev/image/upload/s--sZ2Ckdx1--/f_auto/v1754342063/posts/wv1PLJWAk?_a=BAMClqZW0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":90},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":22}],"comment":[{"@type":"Comment","text":"This is a very silly video to say the least. To use a datetime instead of boolean? That is simply WTF. Like in his example, a simple todo app, having Done as a datetime is fine, unless you want to toggle it. A better option would be to use a byte or even int as Done, and have a datetime for UpdatedAt, or have another log table for simply events which you then have a one to many relations.\nUsing a byte or even int is perhaps better than a boolean, you either have 0 or anything that isn’t zero. Having a datetime for fields like IsDeleted, IsHidden and many other cases is simply stupid, because if you want to make the record IsHidden = 0, you need to set the value to NULL which is always a gymnastic operation on best of days, indexes go nuts over such.\nI always see videos like this with titles like “Never do this …”, “Why I stopped doing this”, “Never use … whatever”. Theo GG does this for all his videos basically, which is why I blocked him. Those videos are always nonsensical. At best they talk about a very extreme case which you basically will never get into.\nThis is just a video to scare you or make you uncomfortable. This video is quite silly, stupid even and his case is so weak. This is at best just a nonsense clickbait video.","datePublished":"2025-08-06T10:15:45.639Z","url":"https://daily.dev/posts/i456F8Q6R#c-5dgGjSrDm","author":{"@type":"Person","name":"Trausti Thor Johannsson","url":"https://daily.dev/traustitj","image":"https://lh3.googleusercontent.com/a/ACg8ocJP2b_9n1STHZ_YtevY9ZAgEvXSN3VB1Q3MGjNqcnfrsm5wjkhR=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":94}},{"@type":"Comment","text":"while I have advocated for this for a long time, databases struggle with indexing and querying when most rows have it NULL.\nNowadays I use a combo od datetime field + autogenerated column that is boolean purely for queries that test if something was done, not when","datePublished":"2025-08-06T02:18:22.970Z","url":"https://daily.dev/posts/i456F8Q6R#c-VVwB4Oy8R","author":{"@type":"Person","name":"Maurício André Cinelli","url":"https://daily.dev/maurcioandrcinelli","image":"https://lh3.googleusercontent.com/a/ACg8ocLoZg3b4tCFMkMxGKsm3507772G8l8VGKlkaWLiUzwnETDWHZqp=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":9}},{"@type":"Comment","text":"Does “You should stop using booleans in your database” mean we should use char data type with ‘Y’ or ‘N’ constraint?","datePublished":"2025-08-06T07:07:57.550Z","url":"https://daily.dev/posts/i456F8Q6R#c-StveOQqnm","author":{"@type":"Person","name":"Volodymyr Hoida","url":"https://daily.dev/crossplatform","image":"https://media.daily.dev/image/upload/s--mecc21JQ--/f_auto/v1777930646/avatars/avatar_oFvh25hEfEcJLoQ3TZnTq?_a=BAMAMiWQ0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":9}},{"@type":"Comment","text":"DateTime instead of boolean? WTF? You either need one or the other. Which one you need is defined by the requirements that you have. If you don’t know what the requirements are, you are either making the second step before the first (i .e., when you are a single developer), or should throw this back to the person who wrote down the requirements (if you work in a team/company) and tell them to do their job right the next time.","datePublished":"2025-08-08T01:58:36.996Z","url":"https://daily.dev/posts/i456F8Q6R#c-T5b3eWET2","author":{"@type":"Person","name":"Axel Howind","url":"https://daily.dev/axelhowind","image":"https://media.daily.dev/image/upload/s--O0TOmw4y--/f_auto/v1715772965/public/noProfile"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4}},{"@type":"Comment","text":"Vibe Database-ing !","datePublished":"2025-08-08T23:33:27.149Z","url":"https://daily.dev/posts/i456F8Q6R#c-Yi2P2Peve","author":{"@type":"Person","name":"7-Zark-7","url":"https://daily.dev/zx8086","image":"https://media.daily.dev/image/upload/v1666169239/avatars/avatar_rsfQchPIj.jpg"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/laraveldev","name":"Laravel Dev"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Laravel Dev","item":"https://daily.dev/squads/laraveldev"},{"@type":"ListItem","position":3,"name":"You should stop using booleans in your database"}]}
```

