@theprotonguy0: How do you go about adding a new column to a database table that gets thousands of writes every single second? #programming #fypシ゚viral #softwareengineer #backenddeveloper #goviral
you add the new nullable column that is empty to the DB so that new writes are recorded in the new column then you update the code so that the app doesn't break and then back fill the 500 m records that you need to update while new writes are already updating the new added column
2026-08-18 04:52:22
2
Brian Dave :
Funny how we always like debating about situations we’ll probably never encounter
2026-08-18 12:10:54
4
xo0 :
Ask Claude😁😂
2026-08-18 05:05:35
15
@laravel :
but the answer will depending on the type of database even if its relational database.
1. make sure you set the collonm default value as null because this how no writing effect.
2 set the lock wait timeout because when performing this over millions records can cause other requests to wait and that might cause them to wait too long which can cause timing out effect on your endpoint.
2026-08-18 10:56:51
2
Mr Nobody :
What l will do l will run a alter table with the column with null values this will take less time than adding values. Then you will update you code and then we don't make it insert values at once but we can make it update the column on login or an event which doesn't make it write many records at once
2026-08-18 08:06:35
2
Kobby_Prime🦦🦦 :
1. it's simple, you must point to a backup database to keep the service running,
2. add the Column to the primary database, when its done.
3. point the service to the primary database.
then add the Column to the secondary database now, but notice that write on the exchange must be done before change over
2026-08-18 09:59:45
0
Eniola | FullStack Developer :
You first make the column nullable and run the migration, then update your code to write the value to the column for new writes you then backfill the old records using a background job then when the backfill is done you can then make the column not null (if it’s suppose to be not null)
2026-08-18 10:43:59
10
Abk :
Add the column as a nullable column. Make sure all new entries to the database start populating that field. Have a background job to backfill all old entries
2026-08-18 11:25:55
4
Lastissa :
i will run the migrations but before doing that, I'll temporarily stop the service, run the migrations and then start the it back.
2026-08-18 08:58:12
3
404ꏂꋪꋪꄲꋪ :
try the migration on a test server with dummy records when it works....voala then you take it to the production server
2026-08-18 16:08:52
1
ISLAMIDEENA✨ :
we may let the backend write to yhe old column you usung b4 then part to the new column too
nd we can also add a pause to control cpu usage
it isnt must we write thousands every seconds we can manage it until the colum adapt to the scaling
2026-08-18 06:42:25
1
TOSHIBA :
Make the new column nullable so it doesn't affect the DB
2026-08-18 05:45:00
1
TheRamz :
Ask Claude
2026-08-18 08:28:37
2
Collin_Codes :
its simple for 500m writes, you will add a nullable columns that users can not write or update to. This is the safest measure. Then do a back fill gradually in small batches while the application is running. correct me if I am wrong.
2026-08-18 12:35:19
1
Olaoluwa :
You just add it.
It's a column so it's not affecting anything already existing
2026-08-18 08:55:58
0
orion. :
omo do maintenance first 🤣🤣
2026-08-18 07:48:25
0
Jafar > Builds Web Apps 🖥️ :
500 million wetin?
2026-08-18 04:20:22
0
Uche Ali (developer) :
Make the column nullable and possibly with a safe default value ..
2026-08-18 07:58:56
1
as :
use a relationship
2026-08-18 19:29:13
0
Klev :
By making it nullable
2026-08-18 11:35:27
0
vasc :
lazy migration technique
2026-08-18 14:51:34
0
Conrad Bekondo :
just add it. but make sure it doesn't have a not null clause. in a transaction of course. also if it's going to be indexed, there should be a condition that ignores null values
2026-08-18 18:02:16
0
Goodness | Software Engineer :
This is Duplicate the table for safety first, add it to the new copy, do backfills, and then allow the clone go live, at this scale you want to set a maintenance time
2026-08-18 12:43:30
0
Geomela :
Since we are adding a Column(Attribute) and not a record/tuple/row,
We can give a nullable constraint to the new column, existing records will be null and new/incoming data will be inserted without any issues.
I don't know if I am getting the question correctly.
2026-08-18 16:51:39
1
Brian :
add a nullable field, then batch update values
2026-08-18 14:48:42
2
To see more videos from user @theprotonguy0, please go to the Tikwm
homepage.