TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: PL/Swift – PostgreSQL Functions in Swift

84 点作者 helge5超过 7 年前

4 条评论

alexnewman超过 7 年前
A different approach I wrote in rust<p><a href="https:&#x2F;&#x2F;github.com&#x2F;posix4e&#x2F;rpgffi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;posix4e&#x2F;rpgffi</a><p>With some example consumers: <a href="https:&#x2F;&#x2F;github.com&#x2F;durch&#x2F;google-bigtable-postgres-fdw" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;durch&#x2F;google-bigtable-postgres-fdw</a> <a href="https:&#x2F;&#x2F;github.com&#x2F;posix4e&#x2F;jsoncdc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;posix4e&#x2F;jsoncdc</a>
solidsnack9000超过 7 年前
Being able to push some application logic into the database server can be very powerful for batch operations. Often you need to make real decisions in application logic at several steps along the way.<p>If you use an ORM-like coding style, you get orderly code but performance is terrible because (a) every row is handled in its own transaction and (b) even if it wasn’t there are multiple network round trips per row. One is thus compelled to write a kind of hybrid: insert a thousand rows, do some join, for each row that is returned, add a row to the pile of stuff to be inserted next, do that insert, and so on and so forth, for many steps. Instead of having a loop like:<p><pre><code> for data in input { step1(); step2(); ... } </code></pre> ...you get code that reads like: do step1 for a thousand items, insert, do step2() for a thouand items, insert...<p>With the code running directly in the database, you can write it in a more naive, ORM like style, because calling into the database for an INSERT or SELECT is much cheaper than a network round trip.
评论 #16094896 未加载
cyberon超过 7 年前
Looks interesting PoC. I have written multiple extensions for PostgreSQL in Go. The hardest part is not &quot;glueing&quot; together the tools to make it work. Most of the time it&#x27;s much more easier and faster to just write in C (C++ with wrapper).<p>There are many cases you should consider, like returning rows (composite types) and implementing trigger functions.
评论 #16092827 未加载
stevefan1999超过 7 年前
I’d suggest the authors to change the name, I thought it was about PL&#x2F;I at the first sight.
评论 #16093886 未加载