Louis :emacs: on Nostr: SQL pro tip of the day: sub-optimal: SELECT count(*) FROM mytable WHERE mycolum IS ...
SQL pro tip of the day:
sub-optimal:
SELECT count(*)
FROM mytable
WHERE mycolum IS NOT NULL;
optimal:
SELECT count(mycolumn)
FROM mytable;
#sql #postgresql #mysql #sqlite
Published at
2024-07-08 14:25:50Event JSON
{
"id": "35b6bdc97c01ed2736215e28cd27508e29858660223f7468dcca61d3821d5563",
"pubkey": "584b9282fbc3d56bde321066766c0ebca3c5508e8d1596a8c7f0a15ca830571c",
"created_at": 1720448750,
"kind": 1,
"tags": [
[
"t",
"sql"
],
[
"t",
"postgresql"
],
[
"t",
"mysql"
],
[
"t",
"sqlite"
],
[
"proxy",
"https://emacs.ch/users/louis/statuses/112751329303030968",
"activitypub"
]
],
"content": "SQL pro tip of the day:\n\nsub-optimal:\n\nSELECT count(*) \nFROM mytable\nWHERE mycolum IS NOT NULL;\n\n\noptimal:\n\nSELECT count(mycolumn) \nFROM mytable;\n\n\n#sql #postgresql #mysql #sqlite",
"sig": "332f2a19824c70f39436fcaef742ed66c9d707505e697c4867c32065b73bf6f55041c4592610c7858b262149c504767ebe8a10e356e5f534bbf57284e45295ca"
}