If you've got a relative or friend who tells you letting sunshine into a home kills off germs, it's time to congratulate them on their scientific insight – because a new study shows that sunlight is indeed effective at blitzing bacteria.

In particular, it's the bacteria that live in dust and are linked to problems with respiratory diseases that can be targeted, the research found.

So Florence Nightingale was right, more than 150 years ago: hospitals (and any other buildings) that let the light in are going to be better for our health, while rooms that are mostly dark are likely to have a greater build-up of bugs.

"Humans spend most of their time indoors, where exposure to dust particles that carry a variety of bacteria, including pathogens that can make us sick, is unavoidable," says one of the researchers, Ashkaan Fahimipour from the University of Oregon.

"Therefore, it is important to understand how features of the buildings we occupy influence dust ecosystems and how this could affect our health."

The team created 11 identical, climate-controlled miniature rooms, where the only variation was the type of light allowed in.

Measurements of bacterial levels in the air showed that in dark rooms, 12 percent of the bacteria were viable (able to live and reproduce). That dropped to 6.8 percent in rooms where daylight was allowed in, and 6.1 percent in rooms bathed in ultraviolet light.

Ultraviolet light is known to kill off some germs, but it's usually filtered out by windows.

Those rooms where light was let in also showed fewer bacteria linked to human skin and more bacteria linked to the outdoors – suggesting a dose of sunshine causes indoor rooms to more closely resemble outdoor spaces, according to the researchers.

"Until now, daylighting [illuminating a building with natural light] has been about visual comfort or broad health," one of the team, Kevin Van Den Wymelenberg from the University of Oregon, told NPR.

"But now we can say daylighting influences air quality."

And that might come in useful for future healthy building designs – not only which way the windows are facing, but the materials they're made from, too.

While too much of it is bad for the skin, sunlight is known to be able to act as a mood-booster and a useful source of vitamin D.

It's worth noting that the mini rooms used in the study don't exactly match real world conditions, and the researchers say further investigation will be required to figure out exactly what's going on to reduce the bacterial levels.

After all, a host of different factors can affect the type and number of bugs lurking in indoor air – from how many people live in a building to how well ventilated it is.

"Our study supports a century-old folk wisdom, that daylight has the potential to kill microbes on dust particles, but we need more research to understand the underlying causes of shifts in the dust microbiome following light exposure," says Fahimipour.

"We hope that with further understanding, we could design access to daylight in buildings such as schools, offices, hospitals and homes in ways that reduce the risk of dust-borne infections."

The research has been published in Microbiome.