note
Ovid
<p>There's not enough information to properly fix your problem, but here are a few thoughts. I guess the most obvious question is about your use of "SELECT *". Do you really need to select all of those fields? That's 8 million fields that you are selecting. (Personally, I'm rather suspect about any table that requires 200 fields (it suggests to me that it's not designed properly.) And what are you printing <em>to</em>? Are you sending the data to a socket, to STDOUT, to a file? Those can all have significant performance issues. If you're printing to STDOUT, try printing to a file and see how much faster it is.</p>
<p>And yes, fetchrow_arrayref is faster. Perhaps you can use that and a hash slice? I haven't benchmarked that, so I can't comment on the performance aspect. However, you say that you need to have <tt>$result</tt> as a hashref. Why?</p>
<p>Last question: are you <em>sure</em> those indexes are useful? The SQL statements that you use can suggest indexes you might need, but the data is important, too. Not every field will benefit from an index. Also, have you used a profiler to find out where your SQL is really bottlenecking? (I assume MySQL will let show you query plans). The statement itself seems pretty simple, but whether you're IO bound or CPU bound could make a difference. Talk to a MySQL DBA about this issue. A good DBA is worth their weight in gold.</p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-17000">
<p>Cheers,<br />
<a href="/index.pl?node=Ovid&lastnode_id=1072">Ovid</a></p>
<p><small>New address of <a href="http://users.easystreet.com/ovid/cgi_course/">my CGI Course</a>.</small></p>
</div></div>
454953
454953