[{"data":1,"prerenderedAt":212},["ShallowReactive",2],{"project-35981238":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":36,"aspects":37,"strip":42,"post_text":44,"what":45,"said":73,"maker_in_thread":125,"shape":133,"grid":137,"attempts":173,"same_week":174,"maker_shows":167,"maker_hidden":204,"reader_version":205,"card":206},"35981238","PostgreSQL Query Lock Explainer","Postgres query lock explainer","title","Show HN: Postgres query lock explainer","https:\u002F\u002Fgithub.com\u002FAdmTal\u002FPostgreSQL-Query-Lock-Explainer","github.com","admtal",1684357334,2023,143,14,443,3109,15,"notable","dev_tools","database query analysis","cli",[24,25,26,27,28],"postgresql","locks","migrations","deadlocks","explain","curious",-0.125,{"positive":32,"neutral":33,"mixed":34,"critical":35},1,3,0,2,6,{"docs":38,"design":39,"execution":40,"performance":41},{"positive":34,"critical":32},{"positive":32,"critical":34},{"positive":34,"critical":32},{"positive":34,"critical":34},[32,34,34,34,33,43,34,34,32,34,33,33,34,34],5,"This is like 4 years old, but I’m braver now and ready to share stuff with this community.  I’ve been a lurker for a while.\n\nI made this tool - it’s kind of like “explain” but it tells you about what locks would be required by the query.\n\nI was making it as part of a larger tool that would try to prevent deadlocks during migrations at my last company, I never finished it.",{"problem":46,"audience":52,"pricing":52,"motivation":53,"time_to_build":52,"stack":57,"openness":70,"stage":71,"team_size":72},{"value":47,"source":48,"evidence":49},"Shows which locks a query would require, to help prevent deadlocks during migrations","maker",[50],{"id":51},"post",null,{"value":54,"source":48,"evidence":55},"Built as part of a larger tool to prevent deadlocks during migrations at the maker's last company; never finished that tool",[56],{"id":51},[58,66],{"value":59,"source":60,"evidence":61},"Python","inferred",[62],{"id":63,"by":64,"text":65},"35983084","hn92726819","Not a postgres expert, but it looks like this is checked by executing the query: https:\u002F\u002Fgithub.com\u002FAdmTal\u002FPostgreSQL-Query-Lock-Explainer\u002Fblob\u002Fmaster\u002Fpg_explain_locks.py#L60…",{"value":67,"source":48,"evidence":68},"PostgreSQL",[69],{"id":51},"open_source","launched","solo",{"praise":74,"objections":87,"requests":100,"questions":116,"alternatives":124},[75],{"value":76,"source":77,"evidence":78},"Useful tool for checking migration locks","commenter",[79,83],{"id":80,"by":81,"text":82},"35982670","efxhoy","Neat tool! I prefer using environment variables for my connection info to avoid passwords in my shell history or plaintext config files. The standard[1] ones from libpq work in…",{"id":84,"by":85,"text":86},"35985231","runeks","Link to relevant source code: https:\u002F\u002Fgithub.com\u002FAdmTal\u002FPostgreSQL-Query-Lock-Explainer\u002Fblob\u002Fda1c5fcfe7b1d5f8755c0203ad66ea0e3828c00f\u002Fpg_explain_locks.py#L148-L153",[88,96],{"value":89,"source":77,"evidence":90},"Executes the query to find locks, which is risky for long or non-transactional statements",[91,95],{"id":92,"by":93,"text":94},"35982701","fovc","It would be nice if you added a how it works section to the readme. Knowing that it does `begin; $ {query}; rollback;` under the hood is important. The example with truncate in…",{"id":63,"by":64,"text":65},{"value":97,"source":77,"evidence":98},"Docs don't explain the begin\u002Frollback approach",[99],{"id":92,"by":93,"text":94},[101,105,112],{"value":102,"source":77,"evidence":103},"Add a how-it-works section to the README",[104],{"id":92,"by":93,"text":94},{"value":106,"source":77,"evidence":107},"Warn about statements that cannot be rolled back",[108],{"id":109,"by":110,"text":111},"35985390","mad0","Maybe emitting a warning would be good. I'm no DBA so remembering all operations that cannot be rolledback might be tough. (Though maybe I should know all of them if they aren't…",{"value":113,"source":77,"evidence":114},"Support environment variables for connection settings",[115],{"id":80,"by":81,"text":82},[117],{"value":118,"source":77,"evidence":119},"Are locks taken by trigger functions included?",[120],{"id":121,"by":122,"text":123},"35983392","irrational","If the query causes a trigger to fire, will any additional locks that are created by the trigger(s) (that is, any functions called by the triggers) be noted?",[],{"comments":35,"answered":32,"key":126},[127,130],{"id":128,"text":129},"35983678","Great suggestion, thank you! Done - https:\u002F\u002Fgithub.com\u002FAdmTal\u002FPostgreSQL-Query-Lock-Explainer\u002Fcommit\u002Fda1c5fcfe7b1d5f8755c0203ad66ea0e3828c00f",{"id":131,"text":132},"35983197","The command won't work if you include \"commit\" in the input :)",{"commenters":134,"max_depth":33,"maker_replies":35,"first_comment_mins":135,"lifespan_hours":136},12,108,44,[138,140,142,146,148,150,152,155,158,160,162,163,165,170],[92,34,32,139,93,34],"project\u002Fcritical\u002Fdocs",[128,34,34,141,11,32],"maker\u002Fpositive\u002Fdocs",[143,34,34,144,145,34],"35984344","commenter\u002Fneutral\u002Fnone","LunaSea",[147,34,34,144,93,34],"36004088",[109,34,33,149,110,34],"project\u002Fneutral\u002Fdocs",[80,32,43,151,81,34],"project\u002Fpositive\u002Fdesign",[153,32,34,144,154,34],"35983839","thwarted",[156,32,34,144,157,34],"35984224","0xbadcafebee",[63,35,32,159,64,34],"project\u002Fcritical\u002Fexecution",[131,35,34,161,11,32],"project\u002Fneutral\u002Fexecution",[84,35,33,161,85,34],[121,33,33,164,122,34],"project\u002Fneutral\u002Fperformance",[166,167,34,168,169,34],"35982215",4,"other\u002Fneutral\u002Fnone","miohtama",[171,167,34,168,172,34],"35982785","dboreham",[],[175,180,185,190,195,200],{"id":176,"name":177,"points":178,"category":179},"35905437","Boring Report",1166,"productivity",{"id":181,"name":182,"points":183,"category":184},"35976488","Beepberry",731,"hardware",{"id":186,"name":187,"points":188,"category":189},"35948462","Willow",581,"ai",{"id":191,"name":192,"points":193,"category":194},"35904734","Moderator Mayhem",221,"learning_science",{"id":196,"name":197,"points":198,"category":199},"35958715","Oblivus GPU Cloud",193,"infrastructure",{"id":201,"name":202,"points":203,"category":199},"35966680","lkwebserver",178,false,"v2",{"id":207,"name":5,"line":6,"ai":204,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":208,"top":18,"kw":209,"maker":11,"domain":10,"tier":19,"attempts":34,"strip":210,"url":9,"mix":211,"praise":76,"objection":89,"sub":21},35981238,-0.12,[24,25,26,27,28],"10003500103300",[32,33,34,35],1793991065965]