Dynamical systems coupled in the form of a complex networks have been exploited for modeling numerous real-world distributed systems. Due to the decentralized nature of dynamical networks, and inaccessibility or high control cost, in some applications, it is desired to employ pinning control techniques. A natural question that comes to mind is how one can select the proper pinned nodes and their feedback gains, (i.e., the performance metrics) to optimize the convergence rate to the homogeneous stationary state (i.e., the performance index) while the total pinning cost is kept below a given limit. This optimization problem has been converted into a semidefinite programming problem, and the optimal feedback gains have been derived analytically. Based on these results, for a given set of pinned nodes, an algorithm for determining the optimal feedback gains has been developed. Furthermore, it is shown that the edges between the pinned nodes do not impact the optimal results, and adding an edge between free nodes or between free and pinned nodes modifies the optimal convergence rate in nondecreasing order. Based on the derived analytical results, several interesting properties have been discovered. For symmetric networks, the nodes within a vertex orbit have the same optimal feedback gains, which are independent of the edges within each vertex orbit. For a number of topologies, closed-form formulas are provided for the optimal results. For a network of Chua systems, the impact of cut number is illustrated by comparing the optimal results for different topologies.