This is strictly N=1 — obviously, sleep and pain are individual because everyone's back issues are a little different. I'll just share what finally worked for me...
TLDR: I settled on latex, with different layers of firmness. Also, don't discount the importance of good pillows under your head and perhaps beside your body.
Before my back surgery, I had the same mattress for 20 years. It worked great, zero complaints. After surgery, the pain wasn't terrible, but I was never truly comfortable sleeping. Finding a new mattress was really tough because my wife and I wanted completely opposite things.
We started with a Sleep Number bed, which lets you adjust the firmness differently on each side — that helped a lot since we could each dial in what felt best. Memory foam was a no-go for either of us. Then we tried a latex topper and loved it. We kept that for years.
I also toss and turn a lot, so another big part of my sleep strategy has been a do-it-yourself pillow that I use when I sleep on my side. I use one filled with shredded foam, usually latex that I just buy off Amazon, and I buy extra so I can add or remove filling over a couple of weeks to fine-tune it. That small adjustment makes a huge difference for side sleeping — it takes pressure off my shoulder and helps me stay more comfortable. I went to the extreme here. I use the same stratagy for the pillow under my head. I is adjustable and filled with shredded latex foam.
Ultimately, I realized I had to experiment to get what my body needed, which meant skipping local store-bought options. I also had to be okay with "wasting" a bit of money on trials to figure it out.
Here's where we landed: A split king so my wife can have whatever she prefers — we just make sure the heights match up perfectly. For me, latex is the winner (like a few others have said). I built a 13-inch bed with multiple layers of latex foam of different firmnesses. The top 2 inches is a removable topper, and if my pain level changes, I just swap it for a softer or firmer one. Storing a twin XL latex piece is kind of annoying, but it's 100% worth for me for the flexibility it gives.
You need a solid, supportive base. I built mine, but there are a lot of good adjustable or platforms out there. ). Remember that Latex is extremely heavy. Way heavier than you'd guess. Also, latex can smell for a few days after you open it but it goes away.
This worked for me and allowed me to have the flexibility to have what I wanted and for my wife to be happy
Matt