[DBClientConfig] Use a JOIN to improve performance.

Previous way executes SQL statements many times. This patch just
does once. As a result, the performace is expected to be improved.