This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-22
Channels
- # alda (2)
- # announcements (1)
- # babashka (32)
- # beginners (67)
- # calva (1)
- # cider (19)
- # clerk (11)
- # clj-commons (35)
- # clj-kondo (7)
- # cljsrn (2)
- # clojure (35)
- # clojure-europe (86)
- # clojure-nl (5)
- # clojure-norway (5)
- # clojure-russia (6)
- # clojurescript (16)
- # clr (21)
- # conjure (1)
- # core-async (10)
- # cryogen (1)
- # cursive (12)
- # data-science (1)
- # emacs (29)
- # events (4)
- # figwheel-main (2)
- # graalvm (9)
- # gratitude (7)
- # honeysql (4)
- # hugsql (3)
- # hyperfiddle (23)
- # jobs (1)
- # jobs-discuss (4)
- # joyride (9)
- # malli (2)
- # off-topic (81)
- # portal (7)
- # reagent (19)
- # reitit (1)
- # releases (4)
- # shadow-cljs (121)
- # xtdb (3)
moorning
morning
morning
Good morning ☕
Good morning
I'm learning way too much about Postgres triggers and functions then I want to know...
what's the use-case @U052852ES ?
At least Postgres is very widely used, so more Postgres details will very often be good for your resumé 🙂 Ignoring that you forgot about the details later on 😄
The system I'm working on has about 3.5K triggers and are interconnected in various ways.
and I have to add/change triggers so that we can take part of the compute problem they are currently doing in recursive SQL queries in an external Rust process.
😱 @ 3.5K triggers - i hope they have been very disciplined about controlling and documenting interactions!
but yes, spaghetti code would be a kind description of this system. Large parts of the business logic is in SQL.
as in that's an awful lot of triggers - and triggers can presumably trip other triggers, which sounds like a recipe for a difficult to understand system
why did they choose to use SQL to implement business logic @U052852ES?
a grey-goo system!
I’m learning that where (foo = ANY($1)) or (bar = ANY($2))
is really slow given large $1
and $2
are $1
and $2
sub-queries @U04V5VAUN?
how big are $1
and $2
?
ok, so not massive... i woulda thought that could have been optimised like a hash join... i.e. index scan with hash-tables from $1
and $2
does it get quicker if you put $1
and $2
into temp tables and do an explicit join ?
In my (very limited!) experience, handling arrays just leads to wishing you'd done a relational table instead.
The only advantage that I know of with arrays is that when fetching data, you don't have to do an explicit join to get the equivalent of an array via tables. But you lose out on a bunch of readily available and better understood table-oriented SQL.
Always ready to get schooled, though 🤓 hope you figure out your problem, @U04V5VAUN
@U04V5V0V4 but it isn't composable!
yes, functions can call each other. But in my experience you can't (or it is difficult) to just combine code and glue it together. ymmv of course
Can you write tests for SQL functions? :thinking_face:
i guess the difficulty with composing sql fns is managing side-effects - they are mostly not very pure
kinda depends on whether they are contained within the same transaction ie is the shared mutable state updated consistently?
Bom dia!