You can put the query in your global.php file (core file edit). Because it's in header, so, you'll get one additional query for every page.
Or, maybe you can use cache and/or maybe use the task system to update the cache (maybe can be done with a plugin).