in reply to Basic Perl array intersection faster than mysql query join.

Memory access is much faster than disk access, so if you can keep your whole database in memory, calculation can potentially happen much faster. So if you don't need the subtle relational capabilities of SQL and it can all fit in RAM, by all means stick with hashes or arrays.

-Mark

  • Comment on Re: Basic Perl array intersection faster than mysql query join.

Replies are listed 'Best First'.
Re^2: Basic Perl array intersection faster than mysql query join.
by pg (Canon) on Oct 12, 2004 at 20:33 UTC

    I found the same thing with c and Oracle.

    Your memory/disc thing is a very good point, the other important point here is the access path, especially with complex joins and big tables. The acess path that the database pick might not be the most optimized one.

    One usually code for the best algorithm for a specific situation, but database has to follow some algorithm that is faster for most situations, but not the fastest for every situation.

    But my experience with Oracle, usually it is a good idea just let the database do whatever it thinks as right, unless the difference is too big. By doing this, you reduce the chance of bugs in your code. Some take give thing.

      The acess path that the database pick might not be the most optimized one.

      The EXPLAIN command can be useful when trying to figure out exactly what the database is doing, and how to optimise it.