The right barrel length for you depends on your shooting needs and preferences. Generally speaking, shorter barrels are best for home defense and maneuvering in tight spaces.
Also consider that when you add 1 inch of length to a shorter barrel, its foot-per-second velocity can increase by up to 200 feet.