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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Language that treats key-value DBs like memory?

2 点作者 felipelalli大约 2 年前
Hello everyone! I&#x27;d like to know if there exists a programming language that, instead of being mapped to memory, is mapped to a key-value database? In other words, one that treats the key-value database as if it were a large memory space? This way, I could, for instance, use any complex data structures like binary trees, linked lists, queues, graphs, etc., as if I were working in memory, but it would actually be done in a key-value database?<p>If such a thing exists or is possible, how would the performance be? I imagine the performance would be significantly degraded? Or could caching help mitigate this? If such a thing exists or could exist, how would the distinction be made between in-memory and persistent structures? For example:<p>A let a_xpto: i32 = 10; would place the value &quot;10&quot; in the memory region called &quot;a_xpto&quot;. If it were persisted, it could be something like: ^let a_xpto: i32 = 10; which would place the binary value &quot;10&quot; in a key-value position with the key &quot;a_xpto&quot; where the &quot;^&quot; directive would indicate that the writing would be done in the database and not in memory.<p>Wouldn&#x27;t such a language solve all the age-old problems we face at the interface between code and databases? I see that today we have numerous databases, each with a different purpose, a different interface, and communication between code&#x2F;data structures in memory vs databases is always very painful. We&#x27;re always left wondering: should we create this function in the database or in the code? How would the performance be? And if I have more than one type of database? How do I integrate them? Should I load everything into memory to filter? Or should I filter something in the database before processing further?<p>Additionally, we end up with that odd-looking code that passes strings to databases. Even when using an interface that &quot;maps&quot; the database to objects, it&#x27;s still not great. It&#x27;s always a pain to modify the database, for instance. If something like what I&#x27;m describing existed, it wouldn&#x27;t matter which database was behind it. I know that Datomic does something in this direction: it abstracts a database, allowing you to easily swap out the underlying database type. However, it&#x27;s still not quite what I&#x27;m talking about. What I&#x27;m describing goes beyond that: you would use the same data structures, objects, etc., that you&#x27;re used to working with in your code, but in a persistent manner.<p>Can anyone shed some light on this?

3 条评论

sargstuff大约 2 年前
From a compiler as system environment perspective, there are a couple of approaches used:<p><pre><code> -- 4gl languages[0] aka direct in-language support for database(s) -- programming language library extensions for dealing with specific types of databases&#x2F;database formats -- use of a programming language&#x27;s standard file&#x2F;internet read&#x2F;write functions to import&#x2F;export formats such as ODBC,json, html and ascii delimited file(s). </code></pre> [0] : <a href="https:&#x2F;&#x2F;www.techbaz.org&#x2F;blogs&#x2F;generation-of-programming-languages.php" rel="nofollow">https:&#x2F;&#x2F;www.techbaz.org&#x2F;blogs&#x2F;generation-of-programming-lang...</a>
sargstuff大约 2 年前
Description of types of DBMS[0], in-memory DBMS[1][2]<p>List of in-memory databases[3]<p>A DBMS not designed as an in-memory DBMS can realize in-memory DBMS benefits via being used on a ramdrive[4].<p>[0] : <a href="https:&#x2F;&#x2F;www.techbaz.org&#x2F;blogs&#x2F;dbms.php" rel="nofollow">https:&#x2F;&#x2F;www.techbaz.org&#x2F;blogs&#x2F;dbms.php</a><p>[1] : <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;In-memory_database" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;In-memory_database</a><p>[2] : <a href="https:&#x2F;&#x2F;medium.com&#x2F;@denisanikin&#x2F;what-an-in-memory-database-is-and-how-it-persists-data-efficiently-f43868cff4c1" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@denisanikin&#x2F;what-an-in-memory-database-i...</a><p>[3] : <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_in-memory_databases" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_in-memory_databases</a><p>[4] : <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;RAM_drive" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;RAM_drive</a> (* virtual environment : <a href="https:&#x2F;&#x2F;snarky.ca&#x2F;how-virtual-environments-work&#x2F;" rel="nofollow">https:&#x2F;&#x2F;snarky.ca&#x2F;how-virtual-environments-work&#x2F;</a><p><pre><code> vs getting around physical board space limitations : ddr ram over pcie : https:&#x2F;&#x2F;ddramdisk.store&#x2F;shop&#x2F; clx, omi : https:&#x2F;&#x2F;semiengineering.com&#x2F;cxl-and-omi-competing-or-complementary&#x2F; )</code></pre>
sargstuff大约 2 年前
** Generally, the system environment a program is started from provides the<p>interface to persistent&#x2F;non-persistent resources used by&#x2F;accessible to the<p>running program. Within a program, the resources provided by system environment<p>running the program can be interpreted&#x2F;used by the running program in a way<p>different from the system environment.<p>-- The running program does not have to interpret the persistent&#x2F;non-persistent<p>resources in the same manner as the OS. aka data file program provided by OS is<p>stored in windows file format on hard drive. The program can interpret the<p>aforementioned data in the file as something other than a windows format after<p>the OS has fetched the file information.<p>** Not clear what single category of system environment using. (OS, DB,<p>integrated developer environment, file editor, compiled program,<p>interpreted program).<p>** Not clear if talking about program data input sources &amp; when&#x2F;how input<p>sources are used. aka From command line, redirecting database query result<p>containing a runnable shell script as input to a command line shell.<p>** The system environment a program is run from can make the resources<p>a running program uses appear to come from something different than<p>where the system environment got the resources from -- aka. program<p>environment provides running program a file from local hard disk,<p>where the &#x27;file from local hard disk&#x27; might have been fetched by the system<p>environment via internet connection from a cd located on a remote machine.<p>Virtual machines running macOS under windows is one example.