The balancing act between high electronic and low ionic transport influenced by perovskite grain boundaries