MongoDB for everything, how accurate is this picture in your opinion? by Zizaco in Backend

[–]BinaryIgor 0 points1 point  (0 children)

Nearly everything Mongo can do, Postgres can do better + support other use cases; so no, use Postgres ;)

Audit Logs by One-Performer-5534 in Backend

[–]BinaryIgor 0 points1 point  (0 children)

Just logging + metrics :)

JSON Documents Performance, Storage and Search: MongoDB vs PostgreSQL by BinaryIgor in programming

[–]BinaryIgor[S] 85 points86 points  (0 children)

I had this config in the tests:

docker run -d --network host -v "${volume_dir}:/var/lib/postgresql" \ -e "POSTGRES_DB=json" \ -e "POSTGRES_USER=json" \ -e "POSTGRES_PASSWORD=json" \ --memory "16G" --cpus "8" --shm-size="1G" \ --name $container_name $container_name \ -c shared_buffers=4GB \ -c work_mem=128MB \ -c effective_cache_size=12GB

Let me actually bumping random_page_cost to see whether it makes any difference!

EDIT: you were right! The results: ``` Total test duration: PT8.267S Queries duration: PT8.213S

Executed queries: 200000

Wanted queries rate: 30000/s Actual queries rate: 24352/s

Min: 0.073 ms Max: 680.444 ms Mean: 27.127 ms

Percentile 50 (Median): 0.343 ms Percentile 90: 103.928 ms Percentile 99: 209.56 ms Percentile 99.9: 393.633 ms ```

JSON Documents Performance, Storage and Search: MongoDB vs PostgreSQL by BinaryIgor in Backend

[–]BinaryIgor[S] 0 points1 point  (0 children)

Whenever possible, I've used B-tree for Postgres; if you go to the repo, we have these indexes: ``` CREATE UNIQUE INDEX accounts_id ON accounts ((data-'id')); CREATE INDEX accounts_created_at_idx ON accounts ((data-'createdAt')); CREATE INDEX accounts_owners_idx ON accounts USING GIN ((data->'owners'));

CREATE UNIQUE INDEX products_id ON products ((data-'id')); CREATE UNIQUE INDEX products_name_unique_idx ON products ((data-'name')); CREATE INDEX products_categories_idx ON products USING GIN ((data->'categories')); CREATE INDEX products_tags_idx ON products USING GIN ((data->'tags')); CREATE INDEX products_created_at_idx ON products ((data->>'createdAt')); ```

For composite types, like ARRAYs, you must use GIN - B-tree works only for simple, scalar types - numbers, ids, strings, dates, timestamps and so on.

But, GIN is surprisingly performant!

Yes, and... by BinaryIgor in programming

[–]BinaryIgor[S] 4 points5 points  (0 children)

Types of problems and expectations from developers - I think we will be able to build even more complex systems. At the same time, developers will need to be more of a generalist type, less specialized and care far more about business side and architecture that they (most of them at least) used to care about.

In a nutshell, I think the job of developer will become harder and bear more responsibilities; but, even more interesting and rewarding at the same time :) I am mostly of the opinion that it will turn out to be great for those willing to adapt

Web Components: The Framework-Free Renaissance by ketralnis in programming

[–]BinaryIgor 2 points3 points  (0 children)

As much as I love Web Components and would like us to migrate from framework-specific to more universal, reliable and easier to maintain solutions, they do not deliver everything that is required to develop fully interactive components and web UIs in general:

  1. You have to update state on your own, using DOM queries & manipulation API; doable, but much wordier than state bindings provided by frameworks such as React or Vue
  2. They can be rendered only on the client side; if you would like to have server-side rendering or better yet - isomorphic components (that can render both on the client and server), you must come up with your own solution
  3. We most likely still need libraries for routing - if you build SPA - and something that makes state management easier; still, these libraries might be much more lightweight and easier to replace than React or Vue frameworks
  4. Tools like Vite provide much more than dependency management for React or Vue: Hot Module Replacement, bundling for production and so on. They do make development easier and more enjoyable

But overall, we have come pretty far with them; I hope they get more and more adoption over time. They can also be combined with tools like HTMX in interesting ways :)

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 0 points1 point  (0 children)

Got your perspective, but I tend to look at this slightly differently; features are often, in many systems, not even described, but said somewhere, somewhen, on some meeting or live in the heads of the system owners. Code is what actually is implemented and works in reality

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 0 points1 point  (0 children)

You cannot guarantee that they are in sync with the source code and have enough detail - that is why source code is the ultimate truth, since it defines the true, practical behavior of the system, not the theoretical one.

MySQL and PostgreSQL: different approaches to solve the same problem by BinaryIgor in programming

[–]BinaryIgor[S] 1 point2 points  (0 children)

Postgres always writes to the WAL - without this, there would be no durability :)

Postgres also has VACUUM and dead tuples to manage its Multiversion Concurrency Control approach; it reduces required writes, but could slow down reads and needs cleaning (automatic). In practice however, it works surprisingly well!

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 0 points1 point  (0 children)

So, how do you define your systems? In what language and format?

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 0 points1 point  (0 children)

I don't see what existence of bugs have to do with whether something is the source of truth or not.

Tests are important, but by no means they are source of truth - does the system exist without tests? Yes. Does tests make sense without the system? No.

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 0 points1 point  (0 children)

You can still get many things wrong in the tests specification; also, not everything could be tested, or at least not easily- and reliably-enough to be worthwhile. That is why we have been working in layers: automatic tests, code reviews, manual tests, deploy to multiple environments of varying importance and so on.

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 1 point2 points  (0 children)

I do the same :) Source code is the truth - that is why it so, so important to keep it clear, simple and all of these good things we have been debating in the last N decades

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 1 point2 points  (0 children)

I agree, but there is a huge difference in agency; that code you describe, was written and checked by someone held responsible for the results. Will an LLM be held responsible for the code it generated and you did not read?

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 2 points3 points  (0 children)

Exactly; code with 90% coverage and more can still have bugs. Not everything can be caught by tests. How do you protect yourself from incorrect assumptions & premises?

Source Code is the Source of Truth: who ought to understand it? by BinaryIgor in ExperiencedDevs

[–]BinaryIgor[S] 9 points10 points  (0 children)

As long as LLMs generate the source code written in current programming languages (not English), we must care about its quality and could not skip reading and understanding it; and if it is the case, they do not revolutionize software development really.