StasB
@stasb.bsky.social
1 followers 6 following 7 posts
Love hardcore software engineering. My blog: https://github.com/ctapobep/blog/issues
Posts Media Videos Starter Packs
stasb.bsky.social
In #SQL null != null, so if you pass a search param and it could be null, you must explicitly issue 'or is null'. But #PostgreSQL has a special operator for this:

𝑠𝑒𝑙𝑒𝑐𝑡 ... 𝑤𝘩𝑒𝑟𝑒 𝑠𝑜𝑚𝑒_𝑐𝑜𝑙 𝐢𝐬 𝐧𝐨𝐭 𝐝𝐢𝐬𝐭𝐢𝐧𝐜𝐭 𝐟𝐫𝐨𝐦 ?

Looks awkward, but not as awkward as the alternatives.
stasb.bsky.social
Did you know that locks in one table can block operations in another one? If table B references table A and we update A, the newly inserted B may have nothing to reference anymore. So it has to wait. So.. In #PostgreSQL the right way to do pessimistic querying is through SELECT … FOR 𝐍𝐎 𝐊𝐄𝐘 UPDATE.
stasb.bsky.social
Did you know you could compare multiple fields at a time in #SQL?
stasb.bsky.social
How do computers juggle between processes & threads? CPU has a clock component that generates interrupts every N millisec. OS maps this interrupt to its schedule() function. So the CPU gets interrupted in the middle of our code → jumps into OS → OS decides which thread to call next.
#computerscience
stasb.bsky.social
#Microservices (esp. #Kafka) folks confuse Idempotence and Deduplication. One is about ACTUALLY processing the request twice as if it was processed once. The other is about DROPPING the repeated requests. Deduplication is used if we can't make operation idempotent.

See: github.com/ctapobep/blo...
Idempotence is not the same as Request Deduplication · Issue #29 · ctapobep/blog
There's a common confusion about Idempotence among the adepts of the message-oriented architecture - they often confuse it with Deduplication. This confusion started long time ago. E.g. the book En...
github.com
stasb.bsky.social
I don't understand why people prepare for interviews. Sure, the beginners simply don't know any better. But experienced people? 🤔

Learning a skill and preparing for interviews are very different: one is shallow, another is deep. There are people who never learn because they always prepare.
stasb.bsky.social
Many will be surprised, but all the answers are correct. Why? Because O() is the UPPER boundary. E.g. O(N²) says the number of operations doesn't exceed N². What we USUALLY want to write is Θ(N logN).

#computerscience #algorithms