StasB
stasb.bsky.social
StasB
@stasb.bsky.social
Love hardcore software engineering. My blog: https://github.com/ctapobep/blog/issues
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.
September 26, 2025 at 1:14 PM
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.
September 19, 2025 at 7:15 AM
Did you know you could compare multiple fields at a time in #SQL?
September 16, 2025 at 5:21 PM
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
September 15, 2025 at 11:48 AM
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
September 11, 2025 at 9:08 PM