Given that most elementary problems in database design are NP-hard, the currently used database design algorithms produce suboptimal results. For example, the current 3NF decomposition algorithms may continue further decomposing a relation even though it is already in 3NF. In this paper we study database design problems whose sets of functional dependencies have bounded treewidth. For such sets, which frequently occur in practice, we develop polynomialtime and highly parallelizable algorithms for a number of central database design problems such as: ? primality of an attribute ? 3NF-test for a relational schema or subschema ? BCNF-test for a subschema. For establishing these results, we propose a new characterization for keys and for the primality of a single attribute. In order to define the treewidth of a relational schema, we shall associate a hypergraph with it. Note that there are two main possibilities of defining the treewidth of a hypergraph H: One is via the primal graph of H...