in reply to Avoiding too many DB queries

You are probably losing A LOT more time connecting and disconnecting to the database for each call to your method. You should connect to the database once, and store the handle somewhere for re-use. This appears to be an object method, why not store the DB handle in the object?
Also, since you're repeatedly doing effectively the same type of queries, you may want to pre-prepare the standaard queries with Bind Parameters, so the SQL engine doesnt need to re-parse the queries each time.