in reply to search like

Not relevant? For all we know the database is a chemical-driven telepathic jellybase from the planet Zartog. "The three-headed jellybase developers never told me if their database architecture supports autojoins, with GROUP BY and HAVING clauses...."

...believe it or not there is a hint in there somewhere ;)

Update: Actually come to think of it, all you need is GROUP BY, + COUNT(*) - check out your database documentation (from whichever planet it comes ;))

More update: I am also influenced by the doubt as to whether DBI is artificially intelligent enough to insert the required clauses -- it might still query the database for all the rows that meet the where clause which might still be a query from hell at the database end, even though it might be constrained only to return 2 to the caller! Make sure you check the SQL generated by any Perl libraries you do try out.

-M

Free your mind

Replies are listed 'Best First'.
Re^2: search like
by andye (Curate) on Feb 28, 2007 at 14:27 UTC
    it might still query the database for all the rows that meet the where clause ... check the SQL ...

    Could also be worth doing an EXPLAIN on the query - if the DB has to do a table scan then the query could still be slow/heavy even if the SQL looks sane.

      Assuming the DBMS knows "explain", which is why I had to put in the caveat about the DBMS. I myself come from a Sybase background which requires different commands like "set showplan" to do that kind of thing. And what if it's mysql?

      -M

      Free your mind

Re^2: search like
by barrycarlyon (Beadle) on Feb 28, 2007 at 13:36 UTC

    O, its just last time i had a question regarding something similar, the perl lib, (custom built) was irrelvant, its just a table declarion, declaring my columns, and the table name, it calls the database parameters, and calls class::dbi and abstract search

    Barry Carlyon barry@barrycarlyon.co.uk
      You're right in saying that the contents of your specific class are (mostly) irrelevant, but its inheritance tree isn't. It would have been helpful if you had at least mentioned upfront that it derived from Class::DBI. It's always a good idea to supply enough information so that we don't have to guess where a certain method or function comes from.

        I apologized, i forgot to consider the tree

        Barry Carlyon barry@barrycarlyon.co.uk