When my wife had a caesarean in 1995, the philosophy of the nursing staff was to stay ahead of the pain. It worked. By the time I had my surgery in 2021, the nursing staff was mixed. Some believed in staying ahead of the pain, but many of the younger nurses seemed to have been convinced in nursing school that it was their job to stop the opioid epidemic and that meant being stingy with pain meds for their patients. My first night, that was the nurse I had- hardly wanted to give me anything and I was in a lot of pain. The morning nurse came in and he was of the old school philosophy and was able to get me what I needed so that I was comfortable. The game changer was the Dilaudid PCA pump. Dilaudid is heavy duty stuff and if I felt I needed it, I could just push the button. It is designed to limit how often you can push it- I think it was set at one push per 30 minutes max. I only ended up pushing it a handful of times that first day, and hardly pushed it at all the next day. By day 3 I did not need it anymore.
My suggestion would be to self advocate about the pain meds, if you are in pain and get resistance. I totally get that there was a time when hospitals were too loose with pain meds, but I feel that they have swung a little too far in the other direction now. Getting open heart surgery is exactly a time when it is appropriate to be on pain meds if needed- even if they are strong ones for a couple of days. So, don't hesitate to speak up if you feel that you need something a little stronger than what they are giving you to control the pain. Properly controlled pain will also help you feel more comfortable getting up and walking, which is very important while in recovery.