group_by Speed Question

I have in my app's database about 350 'Programs'. The following code
runs in the blink of an eye in the console, but takes for-freakin-ever
when in a controller (or the view, for fragment caching):

programs = Program.order(:name).
@program_groups = programs.group_by{|p| p.name[0, 1]}

Any ideas?