I just installed DBI v1.34 and DBD-ODBC v1.04 on my AS build 633, and
have a question about a query that I tried to test the ODBC connection
to our SQL Server database:

my $sth = $dbh->prepare("SELECT a, b, c FROM table WHERE (c <> 'XYZZY')
ORDER BY a");

will return 109,000 rows in four seconds.  All three fields are
populated in all records.

my $sth = $dbh->prepare("SELECT a, b, c FROM table ORDER BY a");

Omitting the WHERE statement returns 1.5 million rows in 839 seconds;
the additional rows are where field 'c' is null.  The value 'XYZZY' will
never occur in the data.

Why wouldn't those rows be returned in the first query?  Why does it
take so much longer to return these records?

Thanks for enlightening a DBI newbie,

Rick

Reply via email to