I've tried doing my own research, but every case on this seems to vary slightly, so:
My dog semi-randomly throws up. It's usually in the wee hours of the morning, perfect time to wake me up. Sometimes he throws up food, sometimes it's just yellow mucus-y bile. He has a slight ear
infection, we have a solution we put in his ears every few days. (The last doctor said it barely showed up on the microscopy, but I prefer to clean them every day because if I wait three, he'll be shaking his head, holding it to the side, and when I clean it I'll get a lot more purple-black gunk than normal. Not blobs, but it definitely shows up on the paper towel. )
He's almost 12, and we make sure to feed him well--I'd read ahead of time that when changing your dog's food, you need to mix it with the old one to prevent stomach
upset, so we've always done that. (He's on a food he's used to right now, but I mention it because dog food
itself has never been the issue.) We don't feed him table scraps--again, read up on things dogs can eat, so OCCASIONALLY (rarely) he gets a carrot, blueberries, maybe a piece of meat, but it doesn't seem correlated. There is no cause-and-effect--oh, he ate that so now he's throwing up. As said before, it seems random.
He does have access to a garden we put compost on, but it's the same thing--we don't babysit him, but we do try to keep him from eating it, and the corollary doesn't seem strong.
I did read that sometimes, going without food for long periods of time can cause this, and he spends long bouts of time with me in my room, away from his food bowl. We let him eat on his own schedule, and he often eats when we do or after coming inside after a walk. I plan to try to monitor his food a bit more, make sure he eats regularly--but I wanted a professional opinon.
This has been going on for at least five years off and on. No vet has been able to tell us what the problem is specifically--just, "maybe it's something he ate"--and he seems fine immediately before and after the retching, very happy and playful. (Today he actually looked up, bile still hanging from his mouth, and took a flying leap after a squirrel. Then he pooped. It looks normal.) The retching can go on for hours--there've been times when I gave up, left him in an area I didn't mind cleaning up, and went back to bed because I didn't know how long it would last. (He hates throwing up, so often he'll start by making sounds in the back of his throat and trying to drink water. That's decreased lately--I think he's accepted that it's best to just go outside and get it over with.) It's also common for him to throw up two, three times, or for him to throw up and then just make retching noises for a long time before he actually does it again.
He has a fairly low stress environment, unless you count the occasional vacation and the mailman. Run of the mill suburban household, not a ton going on but he gets excited about the little things (as dogs do). The retching also does not increase when he seems stressed out, although he has gotten carsick once as a puppy and still seems anxious when we have to take him anywhere.
Sorry for such a long message; I'm trying to answer as many possible questions as I can. He's in good shape, you can only tell that he's slowed down if you knew him when he was younger, and it's little things, like he's not as eager to jump really high anymore. Border Collie
/Blue Heeler mix, so he's aging gracefully.