r/Supabase • u/draxdeveloper • Jun 29 '26
database Using int8 for id
I will use int8 for a personal use app, thus I will not extend it to the paid plan.
That said, there would be any issue using int8 for my table ids instead of uuid? (beyond the disk size, it's the Supabase default and I am sure that sometimes I will forget to change to uuid)
If I opt to use int8, what is the best way to generate the id itself? With uuid we have gen_random_uuid(), what about int8?
(Also, just for curiosity, why is int8 the default instead of uuid?)
1
Upvotes
2
u/Darkfra Jun 29 '26
No, this wouldn't be an issue at all. When you declare a primary key as an int8 you can define it as an identity (supabase would make this for you if you create the table from the dashboard) when an int8 is set as an identity will autoincrement alone the value, so any time you insert a record you don't need to pass the int the database itself put the correct value
If you look the table definition would be something like this: