My boss (and, actually, his boss too, which is the company general director) are generally quite good.
But it happens (seldom, but frequently enough) that they start to fiddle with the details: day to day chores that they should not do.

Examples are: DB queries to extract data, scripts to parse excel files, even re-installing software on their workstation, and the like. The problem is that there are people in the company that could do it much better, much faster. Often, we already have programs or libraries to do what they are trying to do in a more efficient way, or we can create them. 

This is not a very urgent problem, per-se (even if they make mistakes - not being their primary job, they may miss or forget important points), but that eats up their time, and that's the real issue: he does have very little time to "manage" (listen to his subordinates, make decisions, planning...)

How can I convince them to stop "doing", without being rude, annoying, or worse?
(he is still my boss, after all :) )
I know that for some people giving up the "getting my hands dirty" is difficult, but I really feel this is becoming a problem and I want to try to improve the situation.

---

EDIT:
Just to clarify: him doing things is both a problem by itself (but that is specific to my case, so I won't bother you with this part), and above all, a problem because it hinders his ability to manage others. Getting an answer by email is very difficult, meet him 1-1 to discuss projects, software to buy, planning, requires days or weeks, etc.

I am a team leader myself, and I strongly believe in leading by example, which means also working with your colleagues, but my first obligation with my people is to lead them, otherwise I may end up blocking 10 developers because they are waiting for an answer from me.
['https://workplace.stackexchange.com/questions/42335', 'https://workplace.stackexchange.com', 'https://workplace.stackexchange.com/users/7408/']
Is this actually a problem?
===========================

I fairly recently had this exact experience. My manager was considerably more interested in doing day to day work than managerial duties, such as:

* [Caring about resource management](https://workplace.stackexchange.com/q/9128/2322)
* Effectively working with other managers
* Making our team's project work [visible](https://workplace.stackexchange.com/a/11818/2322) to others

I had many conversations about this very subject, to the point where I (and others on my team) were told to effectively "just worry about your own position and not what others were doing." Well, our main problem was that my manager was *not* effectively leading the team and the key obstacle to our project being successful was in fact our manager not doing the leadership/managerial duties.

Your concerns are absolutely valid.

Some things to keep in mind:

* Some people are managers because of circumstance, rather than desire/ability. Many a manager gets there because they happen to be the most senior individual contributor even though they may be considerably more effective as an individual contributor than manager. Or other reasons unrelated to their ability to manage.
* Some managers never accept the idea that they are managers and not worker bees.
* Management offers considerably more ambiguous "what did I do at work today?" answers. For many people who like checklists and feeling accomplished, this can make work very hollow/meaningless
* Management is a huge step outside a comfort zone for many people. The longer someone has been an individual contributor, the more difficult it can be.
* They might be totally aware of this issue but having a really hard time doing anything about it.
* This becomes more important the larger a team is. If your boss has 3 direct reports, it's less important. But if you have a team of 10, your manager doing day-to-day work is considerably more problematic.

What can you do about it?
=========================

Don't focus on the things you can't change (ie your manager's tendency to do work he shouldn't do).

Focus on what your manager is *not* doing for you and your team. Are you not getting the resources you need from him? Is your team not working together effectively? Do you need a team meeting/etc?

If you don't have regular 1/1s because of your manager is too busy doing day-to-day work, don't say "you should stop doing day to day work so we can have 1/1s" but just approach it from the "can we have 1/1s? this would be helpful for x/y/z reasons."

If your team needs more visibility, approach it from the perspective of, "hey, what do you think we can do to get our team more visibility?"

In addition to this, be sure to thank your manager for the effective managerial work that he does. People respond surprisingly well to positive feedback. Continually reinforcing your manager for managing is a easy, non-threatening way you can encourage them to manage rather than do day-to-day work.

---

This [answer](https://workplace.stackexchange.com/a/11606/2322) to a related question is quite informative.
It isn't your place to do anything about this. Your manager will manage his time according to his boss and himself. If it's not affecting you then you shouldn't say anything. 

If it is affecting you, for example he hasn't made a decision on which way a project should go, politely ask him for a decision and state that your work is being held up by the lack of a decision. If his queries are impacting on your work then you should point out to him how it is impacting and the right tools / libraries to use to avoid impacting on you in the future, focus on the way for him to stop impacting your work and you might just find he realises he's a bit out of touch and stops on his own. However if he wants to run those queries rather than delegate then that's his right as the Manager.

If it's such a big problem then find another job (and mention why you're leaving in your exit interview), or find a way to become a manager on the same level as him (if that's possible) and then you can talk to him as a colleague rather than your boss.