FAQ
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

Search Discussions

  • Tim Bunce at Mar 8, 2003 at 9:06 pm
    http://www.google.com/search?q=sql+null+three+value

    Tim.
    On Fri, Mar 07, 2003 at 04:36:41PM -0500, Rick Nakroshis wrote:
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedMar 7, '03 at 9:36p
activeMar 8, '03 at 9:06p
posts2
users2
websitedbi.perl.org

2 users in discussion

Tim Bunce: 1 post Rick Nakroshis: 1 post

People

Translate

site design / logo © 2022 Grokbase