On Mon, Mar 31, 2003 at 11:42:37AM -0600, Michael Muratet wrote:
> I have discovered that it is the placement of single quotes around the
> key value in the query:
>
> > my $rth = $dbh->prepare("SELECT * FROM demographics_1 WHERE
> > KEY1=$key");
>
> that makes the difference. The above takes 90 secs.
>
> The below takes milliseconds (as it does from the command line):
>
> > my $rth = $dbh->prepare("SELECT * FROM demographics_1 WHERE
> > KEY1='$key'");
>
> Without the single quotes, the command line interface will tell you that
> you have a bogus column name. I guess the DBI interface is able to
> figure it out, but it takes awhile.
What is the value of $key?
Anyway, you should probably be using placeholders.
Ronald