There are many *NIX system-level routines for doing so. In BSD, 'device MD' is the system-level ramdisk. Also to be considered are shared memory (SYSVSHM). There is a slight overhead penalty for accessing chunks of this, but it's less than a filesystem access. As has already been stated, SQLite is capable of being wholly memory-resident. I'm not sure that it will stay resident, though, as the swapper comes for all of us.

The only way I know of to make sure your data will stay in memory is to compile it into the kernel, since the kernel is the only process that will never be swapped. If you carry the recompilation far enough, e.g., adding global symbols to the C compiler and Perl interpreter, you can access this as though it is just another Perl data structure. For most cases, it's rather dumb to go this far, but I have seen it done (not in Perl, in Apache w/modules) on a dedicated system, and it can provide dramatic speedups.

In reply to Re: SQLite database (or any) file in main memory! by samizdat
in thread SQLite database (or any) file in main memory! by Ace128

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.