A large new study has found a link between taking common over-the-counter pain killers and increased risk of having a heart attack, even within the first week of use.

The research looked at several NSAIDs (nonsteroidal anti-inflammatory drugs, such as ibuprofen) - the most common painkillers in the world, many of which are readily available over the counter. Previous studies have already shown an association between NSAIDs and heart failure, and now this latest study gives us a better idea of what kinds of doses are involved.

A team led by Canadian scientists combed through medical databases on studies involving drugs like ibuprofen, diclofenac, celecoxib, and naproxen (found under such brand names as Motrin, Celebrex, and Aleve).

The researchers wanted to analyse 'real-world use' of said painkillers, at any dose. After all, many of us just pop a tablet when needed, and don't rely on long-term doses, which are more closely investigated in clinical trials.

"The timing of the risk, the effect of dose, treatment duration, and the comparative risks between NSAIDs are poorly understood," the team writes in the paper.

Data from nearly half a million patients - a total cohort of 446,763 people - showed that any dose of NSAIDs is associated with an increased risk of heart attack, even within the first week of use.

Comparing people who took painkillers to those who didn't, the team found an increase of heart attack risk of about 20-50 percent, with a similar result for all the different NSAIDs they looked at.  

But don't panic and flush your painkillers down the toilet just yet (actually, don't ever flush medicine).

As usual with such association studies, the researchers found an increase in relative (not absolute) risk of heart attack, and that's a super-important difference.

Relative risk means how much more likely one group is to develop a disease in comparison to another (in this case, heart attacks in people who take painkillers, versus those who do not).

Meanwhile, absolute risk is the one that tells you how likely you are to get a disease at all.

So, if ibuprofen were found to increase your absolute risk of heart attack by 50 percent, that would be really horrifying news.

But most people already live with only a small chance of ever having a heart attack, in which case the possible NSAIDs contribution would still be tiny.

"The risks are relatively small, and for most people who are not at high risk of a heart attack, these findings have minimal implications," London School of Hygiene & Tropical Medicine pharmacoepidemiologist Stephen Evans, who wasn't involved in the study, told CNN.

"All effective medicines have unwanted effects, and NSAIDs, although easily available, are not without some risks, but this study is no reason to induce anxiety in most users of these drugs."

Apart from the vital distinction between absolute and relative risk, it's also important to stress that the study, although it looked at a huge number of people, was still just observational.

The researchers didn't find a direct correlation that showed the drugs were causing the heart attacks. And with a crazy number of data variables to sort through, they couldn't fully rule out all confounding factors, such as obesity or smoking.

As statistician Kevin McConway explained to Smitha Mundasad at BBC News, "it remains possible that the painkillers aren't actually the cause of the extra heart attacks".

For example, people with severe pain could be showing up at doctors' offices, getting advice to take painkillers, and then having heart attacks the next week for a different reason.

Even though the new results sound pretty scary, most of us can continue to take painkillers as necessary.

"[T]hese drugs can provide substantial relief to many patients with various types of pain and the trade off against a relatively small risk of heart disease may well be worth taking," says epidemiologist John McNeil from Monash University in Australia, who wasn't involved in the study.

"The longstanding advice to take the lowest effective dose for the shortest time is sound, especially in those whose risk of heart disease is already high."

Still, it's great for medical professionals to see such a large meta-study on the subject. NSAIDs are extremely popular, and the more that doctors know about all their potential risks, the better.

The research was published in BMJ.