# Modeling for Concurrency

DevFeed: [Modeling for Concurrency](<https://devfeed.tech/articles/modeling-for-concurrency-34602.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2018/07/modeling-for-concurrency/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2018-07-10T08:26:47Z

Content type: article

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [SQL](<https://devfeed.tech/topics/sql.md>)

Tags: [concurrency](<https://devfeed.tech/tags/concurrency.md>), [database](<https://devfeed.tech/tags/database.md>), [enum](<https://devfeed.tech/tags/enum.md>), [locking](<https://devfeed.tech/tags/locking.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

This article explains how to model tweet likes and retweets in PostgreSQL for concurrent workloads. It replaces counters that require concurrent updates with activity records, then derives counts from those records and uses inserts for new actions.

## Source excerpt

Let's continue to dive in PostgreSQL Concurrency. Last week's article PostgreSQL Concurrency: Isolation and Locking was a primer on PostgreSQL isolation and locking properties and behaviors. Today's article takes us a step further and builds on what we did last week, in particular the database modeling for a tweet like application. After having had all the characters from Shakespeare's A Midsummer Night's Dream tweet their own lines in our database in PostgreSQL Concurrency: Data Modification Language, it's time for them to do some actions on the tweets: likes and retweet. Of course, we're going to put concurrency to the test, so we're going to have to handle very very popular tweets from the play!