Discuss Scratch

ten_6044
Scratcher
100+ posts

Project ID question

What is the number format used for storing project IDs?

I'm worried because I thought they were stored as 32-bit signed integers, which allow numbers up to 2,147,483,647.
AmpElectrecuted
Scratcher
1000+ posts

Project ID question

I remember you from snap!
I'm not exactly sure how they're stored, but I believe the scratch team can convert them to 64-bit integers, which can hold over 18 quintillion projects, wayy more than there are people in the world
We won't be in danger for a few years though

Last edited by AmpElectrecuted (Feb. 1, 2025 08:17:16)

eisjo
Scratcher
100+ posts

Project ID question

The integer limit is only for 32 bits: 2147483647.
For 64 bits it is: 18446744073709551615.

Don't are worried.
mybearworld
Scratcher
1000+ posts

Project ID question

Scratch uses Node.js for its backend, so the limit might be highest number that a `Number` can represent, which is 9007199254740991.

it's much more likely that jeffalo is right, ↓

Last edited by mybearworld (Feb. 2, 2025 13:42:11)

Jeffalo
Scratcher
1000+ posts

Project ID question

i think scratch uses a mysql “INT” to store project ids. according my good friend chatgpt, mysql INTs can store up to values up to 2,147,483,647. so unless anyones planning on making a couple billion projects, we're probably fine.
CST1229
Scratcher
1000+ posts

Project ID question

Jeffalo wrote:

(#5)
i think scratch uses a mysql “INT” to store project ids. according my good friend chatgpt, mysql INTs can store up to values up to 2,147,483,647. so unless anyones planning on making a couple billion projects, we're probably fine.
however, this *does* mean we are halfway to an integer overflow… (though the st will probably figure something out before then, and there's also the gap of project ids between 1.x and 2.0 alpha that might mean the number of projects actually increment slower than the ids might suggest?)

Last edited by CST1229 (Feb. 2, 2025 13:31:57)

CoderMCProX
Scratcher
1000+ posts

Project ID question

ten_6044 wrote:

What is the number format used for storing project IDs?

I'm worried because I thought they were stored as 32-bit signed integers, which allow numbers up to 2,147,483,647.
The oldest has an ID of 103 or 104, and it is by when they are posted… or at least that is what I heard?

Last edited by CoderMCProX (Feb. 3, 2025 13:44:38)

BigNate469
Scratcher
1000+ posts

Project ID question

CoderMCProX wrote:

ten_6044 wrote:

What is the number format used for storing project IDs?

I'm worried because I thought they were stored as 32-bit signed integers, which allow numbers up to 2,147,483,647.
The oldest has an ID of 103 or 104, and it is by when they are posted… or at least that is what I heard?
The oldest project on the website has an ID of 1.
The oldest project that is still shared is #104.

This isn't really related to the question though.

I imagine that the Scratch Team is prepared to deal with an overflow, and keep in mind that it doesn't need to be a signed 32-bit integer, since negative project IDs don't exist, so they could just use an unsigned integer and double the amount of possible projects. Alternatively, they could just start using a MySql BIGINT, which uses a 64-bit integer.

Last edited by BigNate469 (Feb. 3, 2025 15:32:10)

Powered by DjangoBB