this post was submitted on 30 Jun 2024
23 points (100.0% liked)
SQL
476 readers
1 users here now
Related Fediverse communities:
- #sql on Mastodon
- #postgresql on Mastodon
- c/PostgreSQL on programming.dev
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Well abs(sin(x)) is always going to return a value between 0 and 1, and I dunno how casting to bit works.. if it rounds this might be used to consistently grab half the users. If CAST(anything except 0) as BIT —> 1, then this could be used to grab a very small subset of users? If their clientIds happen to be clientId%180 == 0
I forgot to mention this is in SQL Server, so SIN operates on radians. So I THINK this can only ever cast to a 0 when
clientId
is also 0It certainly doesn't for any of the 100,000 existing rows