Search
Get Started
CD
Cloudflare Developers
•
3y ago
Rabid
And I have an index on path
And I have an index on path
Cloudflare Developers
Join
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
83,043
Members
View on Discord
Was this page helpful?
Yes
No
R
Rabid
OP
•
11/11/23, 2:47 PM
I
'm using caching via the hono middleware
R
Rabid
OP
•
11/11/23, 2:47 PM
On the link creation endpoint
, as well as the shortened redirector
R
Rabid
And I have an index on path
I
itsmatteomanf
•
11/11/23, 2:47 PM
Why
?
R
Rabid
OP
•
11/11/23, 2:48 PM
So if someone has already created a build I don
't have two different short urls map to the same long url
R
Rabid
OP
•
11/11/23, 2:48 PM
Though that could probably be minimized with the cache
I
itsmatteomanf
•
11/11/23, 2:48 PM
Storage is more expensive in D1
, but not much
.
R
Rabid
OP
•
11/11/23, 2:48 PM
I
'm more scared of hitting the 2GB limit
R
Rabid
So if someone has already created a build I don't have two different short urls ...
I
itsmatteomanf
•
11/11/23, 2:48 PM
Oh
, I assumed you hashed the build to create the shortened link
.
R
Rabid
OP
•
11/11/23, 2:48 PM
Than the price
R
Rabid
I'm more scared of hitting the 2GB limit
I
itsmatteomanf
•
11/11/23, 2:49 PM
It should
hopefully
increase a bit more during the beta before GA
R
Rabid
OP
•
11/11/23, 2:49 PM
No I
'm using
https://github.com/ai/nanoid/tree/main
to create the shortened URL
R
Rabid
OP
•
11/11/23, 2:49 PM
And that becomes the ID in the table
I
itsmatteomanf
•
11/11/23, 2:50 PM
I see
. I would consider doing the hashing
, though
. It would avoid you adding an additional index on a pretty long column
.
I
itsmatteomanf
I see. I would consider doing the hashing, though. It would avoid you adding an ...
R
Rabid
OP
•
11/11/23, 2:50 PM
Wouldn
't I run the risk of collisions there
?
R
Rabid
OP
•
11/11/23, 2:50 PM
Would be pretty bad
R
Rabid
Wouldn't I run the risk of collisions there?
I
itsmatteomanf
•
11/11/23, 2:51 PM
Technically yes
, practically
? I
really
doubt it
. Provided the hash is long enough
.
R
Rabid
OP
•
11/11/23, 2:52 PM
So just keep a third column with the hash
?
R
Rabid
OP
•
11/11/23, 2:52 PM
And index that instead of the long one
?
I
itsmatteomanf
•
11/11/23, 2:52 PM
Yes
, one option
.
R
Rabid
OP
•
11/11/23, 2:53 PM
Ah
, that
's a good idea
I
itsmatteomanf
•
11/11/23, 2:53 PM
Or just use the hash as the link
R
Rabid
OP
•
11/11/23, 2:53 PM
Well
, the hash would be bigger than I want though
, I feel like 1
-LnFi0Jy6sbF is a pretty nice length
I
itsmatteomanf
•
11/11/23, 2:54 PM
You can do lower lenght hashes
, too
.
I
itsmatteomanf
•
11/11/23, 2:54 PM
Or just use a calculated column with the hash
, SQLite
should
support the hashing function
.
I
itsmatteomanf
•
11/11/23, 2:54 PM
Oh
, maybe not
.
I
itsmatteomanf
Or just use a calculated column with the hash, SQLite *should* support the hashi...
R
Rabid
OP
•
11/11/23, 2:55 PM
Hmm
, not familiar with this
, I
'll have to look into it
R
Rabid
OP
•
11/11/23, 2:55 PM
Thanks
!
I
itsmatteomanf
•
11/11/23, 2:55 PM
I do know there are DB engines that do hash calculations automatically
, SQLite may not so you might need to add it manually
.
I
itsmatteomanf
•
11/11/23, 2:58 PM
By the way
, here are some stats on the hash collision probability
,
@Rabid
https://stackoverflow.com/questions/62664761/probability-of-hash-collision
Stack Overflow
Probability of hash collision
I am looking for some precise math on the likelihood of collisions for MD5
, SHA1
, and SHA256 based on the birthday paradox
.
I am looking for something like a graph that says
"If you have 10
^8
.
.
.
I
itsmatteomanf
•
11/11/23, 3:01 PM
How many options have you got on that tree
? How many possibilities
?
I
itsmatteomanf
•
11/11/23, 3:02 PM
I
'm honestly curious to calculate the chances here
.
.
.
R
Rabid
OP
•
11/11/23, 3:02 PM
Would be hard to calculate honestly
.
R
Rabid
OP
•
11/11/23, 3:02 PM
People can choose
"paragon
" skills
:
R
Rabid
OP
•
11/11/23, 3:02 PM
many many possibilities
R
Rabid
OP
•
11/11/23, 3:02 PM
58 choices for skills to allocate
R
Rabid
OP
•
11/11/23, 3:02 PM
Plus gear choices etc
I
itsmatteomanf
•
11/11/23, 3:03 PM
I see
.
.
.
R
Rabid
People can choose "paragon" skills:
I
itsmatteomanf
•
11/11/23, 3:03 PM
Do you know how many one can select and how many are there
?
R
Rabid
58 choices for skills to allocate
I
itsmatteomanf
•
11/11/23, 3:03 PM
Same here
?
R
Rabid
Plus gear choices etc
I
itsmatteomanf
•
11/11/23, 3:03 PM
And here
?
I
itsmatteomanf
Do you know how many one can select and how many are there?
I
itsmatteomanf
•
11/11/23, 3:04 PM
(Ignoring the fact some can only be chosen if the adjacent is
, like total skill points given vs
. total possible options
)
R
Rabid
OP
•
11/11/23, 3:04 PM
225 max selections for the paragon boards
, 6 boards
, up to 441 tiles per board
R
Rabid
OP
•
11/11/23, 3:04 PM
Boards can be rotated
R
Rabid
OP
•
11/11/23, 3:04 PM
Positioned differently lol
R
Rabid
OP
•
11/11/23, 3:04 PM
they have slots where you can socket
"glyphs
" there are like 50 of those
I
itsmatteomanf
•
11/11/23, 3:04 PM
Oh
, ok
. It
's gonna get too involed
R
Rabid
OP
•
11/11/23, 3:05 PM
Most classes have about 12 gear choices
, plus gems per gear slot haha
I
itsmatteomanf
•
11/11/23, 3:05 PM
If the tables were fixed positions
, it might be done easily ahah
R
Rabid
OP
•
11/11/23, 3:22 PM
Yeah hah
. Well I was mostly worried about collisions if I was generating a shortened version of it that was only like 10 characters long
R
Rabid
OP
•
11/11/23, 3:22 PM
But the full MD5 should be fine
, going to make that change
, thanks for the suggestion
! Should help keep my table much smaller
Next page