What is that 'eval' doing there? That has to be detriment to performance.

No, the {BLOCK} form of eval does not contribute to any sort of detriment to performance here. Certainly not the 12 seconds that the OP is claiming (update: even eval "STRING" wouldn't explain that kind of perfomance hit).

That said, I wonder what the problem is. The OP says the delay is at execute time...I wonder if under the hood Postgres fetches the data at execute time. But that doesn't explain why the query allegedly completes quickly from the command line tool. I might also think that maybe it just doesn't finish quickly, and in the command line it just appears to start returning rows more quickly, but in the example, only 20 rows are being fetched, so it ought to be obvious whether it finishes quickly or not. I might also wonder if Postgres supports permissions on indexes, and that maybe they're not the same between how the OP is executing in the command line vs the perl program. Anyway, it's all just random speculation on my part, as I don't have the OP's system in front of me, so maybe someone else can take a better guess from the information provided, or maybe the OP can provide more information.


In reply to Re^2: DBI execute is slow? by runrig
in thread DBI execute is slow? by mlorenz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.