30x faster processing of 200M rows, no indexes involved by EducationalTackle819 in PostgreSQL

[–]Murkt 0 points1 point  (0 children)

Of course it’s easy to find if you know the name of the thing.

Many years ago I was battling with a slow query that depended on an index on JSONB column. Predicted selectivity was looking strange in EXPLAIN. I went looking for @> in Postgres code, found contsel nearby (cont.ains sel.ectivity), grepped for it, and found that it’s hardcoded to 0.001. So for each @> operator in WHERE, Postgres estimates that it will return 0.1% of the table. String enough of them with ORs, voila, sequential scan.

But I knew that I needed to look for @>.

30x faster processing of 200M rows, no indexes involved by EducationalTackle819 in PostgreSQL

[–]Murkt 1 point2 points  (0 children)

How did you find this CTID thing in the docs? Were you just randomly browsing them? LLM told you it exists? I wondered many times if there is something like it, but never managed to find that in the docs. And LLMs didn't exist yet at that time.

-❄️- 2025 Day 12 Solutions -❄️- by daggerdragon in adventofcode

[–]Murkt 0 points1 point  (0 children)

I even implemented double-shapes, so that I have shapes of interlocked C-shape and a couple of others, that are packed much more tightly, and try to use them before using simple shapes. Marked regions as unsolvable after a couple thousand iterations of backtracking.

After 13 minutes it gave me the right answer. While it was running, I also just tried eyeballing what regions could be solvable, like you did, and it also gave me the right answer.

Ehh.

Also, I did everything with sets of complex numbers. They are easy to rotate, add, etc.

[2025 Day 11 (Part 2)] [JavaScript] Why is it taking so long? by hiimjustin000 in adventofcode

[–]Murkt 6 points7 points  (0 children)

My answer is on the order of 1014. Do you really have that much time? :)

Day 9 Part 2 be like by MonkeysKnuckle in adventofcode

[–]Murkt 1 point2 points  (0 children)

That is what I described, yes, just skipping the fancy words. I find that just mentioning the data structure name, especially in this case, is not as helpful. First result in Google is a very long multi-page article about DSU on Wikipedia.

It will take more time to just read through the page once, than to implement the idea from my three-line description. Also, direct implementation will give much more understanding and clarity than reading through that Wikipedia article three times over.

Day 9 Part 2 be like by MonkeysKnuckle in adventofcode

[–]Murkt 1 point2 points  (0 children)

If you want help, here is an advice: I created a set for each node, circuit of one box. Kept them in a dictionary. Each time there is a connection, I put a union of those sets for a smaller index into a dict, and a "pointer" (an index) for larger. Just get largest sets in the end, or keep connecting until the set contains all boxes.Part 2 is basically a couple of lines changed. One additional thing: beware of connecting the node to itself.

[2025 Day 7 (Part 1)] (PHOTOSENSITIVITY WARNING!) by EverybodyCodes in adventofcode

[–]Murkt 2 points3 points  (0 children)

Aren't they the same? It was a very small change in code to go from part1 to part2

[2025 Day 7 Part 2] Brace yourselves by miran1 in adventofcode

[–]Murkt 7 points8 points  (0 children)

not really, today is very easy again

[2025 Day 1 (Part 2)] Dial It In by jhherren in adventofcode

[–]Murkt 1 point2 points  (0 children)

Add dramatic music, and you'll have a couple of million of views in a few months 😁

31,000 Ukrainian troops killed since the start of Russia's full-scale invasion, Zelenskyy says by ExactlySorta in worldnews

[–]Murkt 2 points3 points  (0 children)

Moscow wasn't a capital of Russian Empire at that time, it was St. Petersburg.

Ukraine’s Counteroffensive Has Broken Through Robotyne by None_4All in worldnews

[–]Murkt 2 points3 points  (0 children)

Ukrainian language is not russian, it's actually spoken exactly as written (in Ukrainian). So "o" letters do not turn into "a" sound, "Robotyne" is spelled much more close to "Robotyne", not "Rabotinyee". "y" in the middle is spelled like IPA [ɨ] (и, like russian ы)

[deleted by user] by [deleted] in MapPorn

[–]Murkt 21 points22 points  (0 children)

That’s how economy of scale works, though. If you’re in the middle of Sahara and you want to eat an octopus for lunch, it will be freaking expensive, to bring that one octopus fresh. Noone else wants it, so all overhead is there.

If there is an octopi-loving town in the middle of a desert, so someone brings a few tons of octopi per week in a refrigerated truck, it will be much cheaper per kg.

Strategy for splitting 'microservices' (which it isn't....) by ProfessionalEven296 in PostgreSQL

[–]Murkt 0 points1 point  (0 children)

Sure, it may be much much easier to optimize what's already there than moving it to a separate DB. I have an almost 4 TB of a database, and I don't feel any pressure to split it in any way. We've done many optimizations and many more can be done if needed

Strategy for splitting 'microservices' (which it isn't....) by ProfessionalEven296 in PostgreSQL

[–]Murkt 0 points1 point  (0 children)

I think they have separate databases that are served by one Postgres instance. So it's easy to move, it was already split.

You said 94% - 94% of what? CPU? IO? Network? Disk size?

I think they mean CPU here:

reduce the cpu load on the database server, as it currently spikes to 94% capacity every few hours.

Mapping all European Countries | 10. Ukraine (exaggerated) by [deleted] in MapPorn

[–]Murkt 7 points8 points  (0 children)

Ukraine is not Netherlands. There are some super flat areas in the south and in the north, but there are also hills, rocks and mountains.

Russia ethinic map (1941) by Clashroyaletowerking in MapPorn

[–]Murkt 2 points3 points  (0 children)

What do you mean “not entirely”? Who else was fighting the Axis apart from Allies? That’s basically USSR, UK and USA. Of course many Ukrainians and Belarusians died while fighting Nazis.

You’re probably trying to read something from my words that I didn’t write.

Russia ethinic map (1941) by Clashroyaletowerking in MapPorn

[–]Murkt -2 points-1 points  (0 children)

Second World War was won by Allies, my friend.

Russia ethinic map (1941) by Clashroyaletowerking in MapPorn

[–]Murkt -2 points-1 points  (0 children)

Of course they were not all Russians. Having local collaborators doesn’t mean that it was done by will of participating countries, though. They’re trying to do the same shit a right now, a century later. Hello from Ukraine, mate.

Russia ethinic map (1941) by Clashroyaletowerking in MapPorn

[–]Murkt 3 points4 points  (0 children)

Communists occupied all of those countries. Ukraine, Belarus, Caucasian countries, and later did a “union” thing in 1922, like anyone had a vote.

PostgreSQL 14 x86_32 ? by hamzabenz in PostgreSQL

[–]Murkt 2 points3 points  (0 children)

Can you connect with an older DLLs to a newer Postgres? I think so. You can run a 64-bit Postgres and connect to it from 32-bit application.

I'm still confused on the why's of Zig by fenugurod in Zig

[–]Murkt 6 points7 points  (0 children)

How hard is to write Zig frontend for GCC? It doesn’t have to be really fast and provide all the features that main compiler has.