> Usually get a new monitor and a new PC every 4 or so years.
Maybe you're not quite the average consumer that OP has in mind? Maybe you are, I don't know. Either way it's unsustainable and ridiculous that the _average consumer_ would need to replace something after 4 years when it COULD be built to last.
My first LCD monitor is still actively used in our house, about 18 years old now. My mother has gone through several computers, kept the same screen for 15 years. Apple Consumers are not "Average Consumers". Starting at $1300, it's a luxury desktop.
That’s a mid-range desktop at most in a world where people pay more than that for individual components at the high-end, especially when you look at pricing for equivalent quality displays.
The correct criticism of iMacs is that it links two parts with different lifespans. There should be a legal requirement that all-in-one computers have an external connector so that if some other component fails or simply becomes obsolete you can use the perfectly functional display with another system.
I agree that the iMac needs to be usable as a monitor. Both Dell and HP all-in-ones that I looked at do this (I did not do an exhaustive search, so it may not be as common as my 'look at two' makes it sound, but it's not UN-common)
However, let's be real clear, iMac is not a mid-range desktop, price-wise. Amazon's all-in-one category's HIGHEST non-apple price in the top-10 is $599. There are three non-apple all-in-ones over $1k in the top-50. [1]
Obviously, once we separate the pieces out, things become even more clear cut. You can buy the beefiest "mini-pc" from amazon and pair it with a 28" or 32", flat or curved 4k monitor for $200-400 and still have money left over.
The iMac is NOT high-end, but it is luxury, and that's an important distinction.
My point was just that while it’s not low-end it’s also not luxury in a world unless you’re defining that term to mean something like “has clean lines without stickers” or “has a better display than a TV from a decade ago”.
Most of the cost of an iMac is the display and as your example shows, you don’t see significant savings unless you accept massive compromises on quality. 1080p FHDs is like saying you have a luxury car because your baseline is a golf cart and most of those have terrible color quality according to their spec sheets even if you ignore the low resolution. By the time you’re getting to models which are only one generation behind on CPU you’re looking at a $900 system with a display which is worse than what Apple shipped almost 20 years ago.
That wasn't their point. The point is that the average consumer doesn't really upgrade their desktop separately from their screen, if the two are separate. You do not need to replace an iMac after 4 years, they are in fact built to last.
> Refactoring our supabase/postgres repo to improve components and utilize nix for building, packaging, and conducting high-level infrastructure tests.
I open up hanamirb.org at least once per week since the announcement of v2 back in November 2022. Pleasantly surprised to see this new view layer announcement today!
Anyone using Hanami 2 in production that would care to share their experience?
Hmmm. The doc kinda suggests that this might be more efficient than doing it with separate commands:
"First, the MERGE command performs a join from data_source to target_table_name producing zero or more candidate change rows. For each candidate change row, the status of MATCHED or NOT MATCHED is set just once, after which WHEN clauses are evaluated in the order specified. For each candidate change row, the first clause to evaluate as true is executed."
Anybody know more about this?
From lots of experience with SQL Server, I know that over there, MERGE is not more efficient, it's just syntactic sugar - and in fact it's buggy syntactic sugar, as there are some conditions where it doesn't handle concurrency properly.
Well MS SQL Merge statement is not very good, and I personally avoid it, and most places I worked in recommend to avoid it, except in the simplest scenarios
From the docs
"At scale, MERGE may introduce complicated concurrency issues or require advanced troubleshooting. As such, plan to thoroughly test any MERGE statement before deploying to production."
I dont know if its better in PQSQL , but they took their time, so maybe it is
That is rather an understatement. IIRC unless you are careful with transaction isolation levels and other options, a single MERGE statement can still deadlock against itself.
Though things are a fair amount better than they used to be, back in 2008 when MERGE was first introduced, with most of the persistent buggy behaviours pertaining to specific features that not everyone uses, I still completely avoid it.
Postgres’ history usually suggests they don’t ship broken database features which is why most of us reach for it as a first option when choosing a database. The MSSQL warning sounds bad enough that I’d never use this feature!
Well, the Postgres docs about MERGE include a similar warning: "When MERGE is run concurrently with other commands that modify the target table, the usual transaction isolation rules apply; see [Concurrency control / Transaction isolation] for an explanation on the behavior at each isolation level. You may also wish to consider using INSERT ... ON CONFLICT as an alternative statement which offers the ability to run an UPDATE if a concurrent INSERT occurs. There are a variety of differences and restrictions between the two statement types and they are not interchangeable." https://www.postgresql.org/docs/current/sql-merge.html
That's not a warning, instead, it's how it should work, and how one would want it to work, i.e. that the transaction isolation rules apply. Lack of this, would have warranted a warning.
> Postgres already has the `Insert foo on conflict do update` type syntax which I think is generally better.
INSERT... ON CONFLICT is awesome, but it has some limitations.
The one I ran into most commonly is that it can only handle exactly one unique constraint on the target table. So if you have both a PK and another unique index, you need to choose which one gets the simple 'on conflict' and which one gets a hacky workaround (locks/transactions, triggers, exception handling, etc.)
If I'm reading the MERGE docs right, you can handle that case:
WHEN MATCHED AND old.pkey = new.pkey THEN UPDATE SET value = new.value
WHEN MATCHED AND old.col1 = new.col1 AND old.col2 = new.col2 THEN UPDATE SET reps = reps + 1
WHEN NOT MATCHED THEN INSERT [...]
The reason is that PostgreSQL has INSERT ... ON CONFLICT which is usually what you want, especially since it handles concurrency in the way you usually want. MERGE has more capabilities but not enough of them to make such a complex feature prioritized.
I would argue that INSERT ... ON CONFLICT is not just a workaround but the correct solution in most cases. It is very explicit about what you want and makes sure that either it can take the correct locks or it will error out if there is no unique index/primary key that it can use to take the lock. But, yes, MERGE can do more things than INSERT ... ON CONFLICT.
Congrats! It would be interesting to hear more about the rewrite, 18% code reduction is significant. Have any of the contributors written about it somewhere?
Maybe you're not quite the average consumer that OP has in mind? Maybe you are, I don't know. Either way it's unsustainable and ridiculous that the _average consumer_ would need to replace something after 4 years when it COULD be built to last.