An argument can be made either way. If you research a lot, ahead of time, you risk wasting time researching things that will never end up in your story, but at the same time, you might encounter little details that you didn't ORIGINALLY plan to include, but they'll just be so interesting that you'll have to include them and this will add to the authenticity of the story.
On the other hand, if you research only what you need as the need arises, you save time not looking into details you'll never use, but again, you risk missing out on the interesting little details that might make your story spring to life.
I remember doing a LOT of research and notetaking for a story I wrote set in ancient Egypt. I ended up getting lots of the little details, but I spent an awful amount of time taking a bunch of notes that I didn't really need.
On the other hand, now I'm into writing about Ojibwa culture and mythology (in a fantasy context), and I haven't been researching...BUT...I have been reading a lot on the subject because it's of interest to me. I have a big collection of related books, and of course, over time, all the reading I've done has seeped into my writing and I've become more informed. I didn't sit and take notes on what I thought I would need; I just naturally incorporated details that I came across in my reading and found interesting, including some I never would have thought of including if I hadn't come across them.
I'm going to read over those books again though and maybe take a few little notes on more interesting points, just to keep them together since I often forget where exactly I read a certain detail, and sometimes I want to verify what I read.
I think in sci-fi you'd need to do more research than fantasy, unless the fantasy (like some that I write) is based on something that actually exists. I think reading up on what you expect you'll need to know is the best route to take, but don't rule out researching other things too; you never know where you'll find the perfect detail for a story.
Just make sure the research doesn't get in the way of the actual writing. You can always go back and fix a mistaken detail later.