Expert in tackling complex software challenges, with deep knowledge of TCP, MySQL and PostgreSQL kernels, and a passion for AI, history, math, and physics.

Beijing, China
Joined October 2012
After nine months of hard work, this Postgres course is almost complete. You don't have to buy it, but if you want to truly understand Postgres internals, this is one of the most detailed courses you'll find. wangbin579.gumroad.com/l/pos…
5
52
1
525
36,764
Once you understand how Rust avoids C's pitfalls, you'll see that Rust itself is actually quite elegant. However, the Rust code most people write is so ugly that it scares many people away.
4
2
1
63
4,284
Neon is another project where I can already see a lot of room for performance improvements.
You can't get a 100,000x speedup just by improving cache locality. Such big performance gains come from many things working together, but the most important thing is choosing the right data structures for large datasets.
1
9
1,310
You can't get a 100,000x speedup just by improving cache locality. Such big performance gains come from many things working together, but the most important thing is choosing the right data structures for large datasets.
Hard to say, honestly. It really depends. The biggest speedup I've ever seen was changing the data structure from a hash table to a well-designed array-based one. Overall, not just from cache locality, that made part of the code about 100,000 times faster.
1
3
1
56
3,986
Hard to say, honestly. It really depends. The biggest speedup I've ever seen was changing the data structure from a hash table to a well-designed array-based one. Overall, not just from cache locality, that made part of the code about 100,000 times faster.
Replying to @wangbin579
When an array wins, how much the gain usually comes from cache locality?
3
1
31
4,909
I have spent the past ten days checking my new home, trying to find as many problems as possible, and asking the workers to fix them. btw, AI is still not very helpful in solving these problems.
Replying to @wangbin579
What did you do here?
7
1,159
Many real-world bugs are fixed in a similar, simple way, including in databases.
3
10
1,219
I've traced through lsm myself, and I don't think it's the best data structure for neon. I choose more suitable data structures based on many factors, which I will share on discord (discord.gg/g8ksTXPPnY). Btw, good database design isn't something AI can do today.
Replying to @wangbin579
Can you share more insights? Whats the data shape and why LSM tree isn't useful here? Sounds interesting!!
1
17
2,633
I really like Postgres now. Once you understand it, almost anyone can build a database. It's not just for experts anymore.
Based on Neon's architecture, I abandoned the LSM tree and designed a new data structure tailored to the data's characteristics. It looks simple and efficient so far, though it hasn't been implemented yet. Anyone interested?
2
4
127
9,978
Based on Neon's architecture, I abandoned the LSM tree and designed a new data structure tailored to the data's characteristics. It looks simple and efficient so far, though it hasn't been implemented yet. Anyone interested?
3
2
1
75
14,159
Using arrays well is not easy. It takes skill, and you need to really understand your data and how it's structured. That's why programming is truly an art. In the future, poorly made databases will be everywhere.
In performance optimization, the data structure I least want to use is a hash (only as a last resort), and the one I most want to use is an array. When a database is full of hashes, there's probably a lot of optimization opportunity hiding in there.
2
3
1
85
5,068
In performance optimization, the data structure I least want to use is a hash (only as a last resort), and the one I most want to use is an array. When a database is full of hashes, there's probably a lot of optimization opportunity hiding in there.
12
9
2
234
17,767
I think I've got the evidence now: in tokio's async model, Rust is far weaker than C in some critical situations. Full breakdown in the Discord group next week. Don't miss it.
Why C? Four reasons. 1) Postgres is written in C too, and I want to reuse its WAL replay code. 2) I don't want to change my taste. I just don't like Rust, which misses a 't' 3) I don't want slow builds or big binaries. 4) I'm not smart enough for Rust.
4
68
9,335
I don't even like C++ and I don't want to use any C standard library, let alone Rust. Most of the time, good optimization is just about getting your algorithms and data structures right, which is something you have to figure out yourself, case by case.
Why C? Four reasons. 1) Postgres is written in C too, and I want to reuse its WAL replay code. 2) I don't want to change my taste. I just don't like Rust, which misses a 't' 3) I don't want slow builds or big binaries. 4) I'm not smart enough for Rust.
1
63
2,880
Why C? Four reasons. 1) Postgres is written in C too, and I want to reuse its WAL replay code. 2) I don't want to change my taste. I just don't like Rust, which misses a 't' 3) I don't want slow builds or big binaries. 4) I'm not smart enough for Rust.
Our product will be written in pure C (sorry, I don't trust Rust). Even if nobody ever uses it, it'll still show you what the art of optimization really looks like.
5
2
2
58
17,120
After comparing the trace info from various Rust extensions vs Postgres C code, it's pretty obvious which one performs better.
Our product will be written in pure C (sorry, I don't trust Rust). Even if nobody ever uses it, it'll still show you what the art of optimization really looks like.
2
21
2,484
Our product will be written in pure C (sorry, I don't trust Rust). Even if nobody ever uses it, it'll still show you what the art of optimization really looks like.
The course will keep getting deeper, since I'm growing fast. After studying Neon carefully, I'll use TigerBeetle's ideas to build a faster version that separates storage and compute, making the course even deeper. Technically, I'm sure I can build a great database product.
5
1
2
85
12,728
The course will keep getting deeper, since I'm growing fast. After studying Neon carefully, I'll use TigerBeetle's ideas to build a faster version that separates storage and compute, making the course even deeper. Technically, I'm sure I can build a great database product.
Me soon, and thank you so much for the course, it really helped me build a mental model of what goes on behind the scenes
1
2
45
10,031
If you've been at Postgres for over two years and still don't get it, you're using the wrong approach.
Two years ago, I was a Postgres newbie. I didn't even know how to install it. Now I feel like I really understand Postgres. Learning Postgres is only hard for DBAs. For developers, it's easy, and the ideas behind it are even easier, as long as you use the right approach.
3
27
2,392
Two years ago, I was a Postgres newbie. I didn't even know how to install it. Now I feel like I really understand Postgres. Learning Postgres is only hard for DBAs. For developers, it's easy, and the ideas behind it are even easier, as long as you use the right approach.
4
7
2
155
8,575
I spent 20 days tracing Neon and digging into all kinds of perf bottlenecks, and I learned a lot. Building a database on top of Postgres is actually simple, and most of you can do it too. You just need the courage to learn Postgres and go build one yourself.
3
62
3,369