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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: GoSQL – A query engine in 319 LoC

81 点作者 archiewood8 个月前
I&#x27;ve always been curious about how SQL engines actually work.<p>So I built a minimum viable SQL engine in Go.<p>- Supports CSV files as tables<p>- Supports SELECT, FROM, WHERE, LIMIT<p>It&#x27;s very simple:<p>1. Parses query string<p>2. Converts it into an AST representation<p>3. Executes the query against the CSV<p>4. Returns the results

6 条评论

stevekemp8 个月前
Nice job.<p>You can see this post for the start of a guide in implementing something very similar &quot;Writing a SQL database from scratch in Go&quot;:<p><a href="https:&#x2F;&#x2F;notes.eatonphil.com&#x2F;database-basics.html" rel="nofollow">https:&#x2F;&#x2F;notes.eatonphil.com&#x2F;database-basics.html</a><p>(Use the tag &quot;sql&quot; to find the later parts. Sadly not linked directly from that first one.)
评论 #41768803 未加载
iamcreasy8 个月前
Nice. I also wanted to know the details behind database engine and ACID compliance. So, decided to follow Database Design and Implementation by Edward Sciore, and re-implemented the database in Python: <a href="https:&#x2F;&#x2F;github.com&#x2F;quazi-irfan&#x2F;pySimpleDB">https:&#x2F;&#x2F;github.com&#x2F;quazi-irfan&#x2F;pySimpleDB</a><p>This db treats file as raw disk and reads and writes in blocks. In the book, your step 3 and 4 will be a start of a transaction that uses recovery manager to log changes introduced by the query, and buffer manager to page in and out file blocks in memory. This book uses serializable isolation, so if buffer pool is full and can&#x27;t page in new block or if another transactions are writing to that same block - the newer transaction will be rolled back after a brief wait.
lainga8 个月前
Try this talk about sqlite!<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZSKLA81tBis" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZSKLA81tBis</a>
zh24088 个月前
Feel like you can achieve something similar in duckdb? duckdb allows you to query local csv, parquet, and even remote ones?
评论 #41771069 未加载
coredog648 个月前
This is very handy given the recent <i>de-emphasizing</i> of S3 Select by AWS.
ddmf8 个月前
Nice one, thanks, I&#x27;ll have a look through this.