The bottom line is that the data and indexes reside on a disk somewhere. Your process can either:
- Load them itself, follow the pointers and extract the required data.
- Or:
- Compete for attention from a DB process.
- Wait for connection.
- Negotiate authorisation.
- Wait while the SQL parser parses your query.
- Wait while the DBM checks your query against the schema.
- Wait while the DBM finds the relevant data and indexes.
- Wait while the DBM optimises your query.
- Wait while it checks/frees cache space for your indexes.
- Wait while it actually runs the query and builds a results table.
- Wait while the communications negotiate the transfer of the results.
- Wait while your process allocates space to hold the results.
- Wait while it structures the results into a perlish data structure.
- Finally, do something with the results if you haven't run out of memory in the meantime.
There are many good reasons for using an RDBMS, not least of which is that someone else does a lot of the work and maintenance, but performance is not one of them!
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.