Sex after a miscarriage.

I had a miscarriage a week ago. I was only a few weeks along. 
Today I was feeling frisky so hubby and I had sex, but it was very painful for me. I'm sore just sitting here. Is this  common? I assume so since my body just went thru crap. How soon is to soon to do it?
Thanks