• solrize@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Hmm, ok, something weird and pg specific might be going on. JOIN to an empty or almost empty table (I guess you mean outer join) sounds surpising but I’d hope the query planner can still do something reasonable. Anyway I don’t feel like I’m being helpful at this point, so I’ll stay out of your way. I’ll be interested to know how it goes though.

    • RoundSparrow@lemmy.mlOPM
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      i’d hope the query planner can still do something reasonable.

      PostgreSQL specifically guards against queries with more than 8 joins… and Lemmy plows right past that.

      • solrize@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        What can I say, that sounds suspicious both from the PG side (complex queries with lots of joins are sometimes useful, such as for reporting) and on the Lemmy side (executing such queries in response to routine web requests is a pretty bad smell). It’s still early days so this seems like a better time to re-examine the schema and migrate if necessary, than after waiting until there’s a ton more data and activity.

        • RoundSparrow@lemmy.mlOPM
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          1 year ago

          It’s still early days

          Lemmy has been on GitHub since February 2019, over four years. It isn’t new at all. Several instances go way back.

          The answer is: ORM.

          • solrize@lemmy.world
            link
            fedilink
            arrow-up
            2
            ·
            1 year ago

            I don’t mean the code is new, I mean the user base and data corpus are small compared to what we are hoping for. You’re probably right about the ORM. :/