• 1 Post
  • 691 Comments
Joined 3 years ago
cake
Cake day: June 15th, 2023

help-circle
  • I’m a programmer and have switched to NixOS, because I can define all my configurations in code+git repo, which is great. I now have a single repo that has some parts that are shared, and some parts are host-specific (one desktop + 2 laptops, for now), and if I fix some bug (like my Samsung 990 Pro SSDs having Linux issues), I know it’ll be permanently fixed, instead of having to re-figure everything out after a reinstallation.

    NixOS BTW. We’re making it ours.

    edit: Steam has been a non-issue, so gaming has been great so far! Not that I’ve been gaming a ton, but still.

    Also, being able to use an LLM to fix stuff for me in my nixcfg repo has been great - I would NOT have been as productive with NixOS had I not have had Codex.


  • Here’s my quick guide to fixing slow queries:

    1. grab your query.
    2. run EXPLAIN ANALYZE <query>
    3. If there’s a Parallel Seq Scan, check the Filter value (which column are we checking) - you should likely try adding an index.
    4. run CREATE INDEX ON <table>(<column>);
    5. run EXPLAIN ANALYZE <query> again to check for improvements

    Note that EXPLAIN <query> will only do a rough analysis, while EXPLAIN ANALYZE <query> will run your actual query, and analyse it.

    If you want to ANALYSE EXPLAIN an INSERT query, do this:

    BEGIN;
    EXPLAIN ANALYZE INSERT ...;
    ROLLBACK;
    

    A simple ROLLBACK will help you here.

    Rewriting the query will typically not do much - it might, but the chance it relatively small vs slapping an index on it.