Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9190585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:29:46+00:00 2026-06-17T20:29:46+00:00

One of our needs is to create an temporal in-memory database, to then perform

  • 0

One of our needs is to create an temporal in-memory database, to then perform various inserts/selects/updates.

At a glance SQLite satisfied all our needs. Connection to an in-memory SQLite DB can be established as simple as:

class SQLiteBase < ActiveRecord::Base
  self.abstract_class = true

  establish_connection(adapter:  'sqlite3', database: ':memory:')
end

A while ago we’ve started looking into some performace issues when it turned out that we need to perform bulk-loading (specifically, bulk INSERTs) of data into our SQLite tables (see these benchmarks).

Unfortunately, it looks like SQLite doesn’t support bulk INSERTs.

So is there any other SQL-based lightweight in-memory databases out there, that support bulk INSERTs?

If there are no such – is there a way to utilize heavyweight databases such as PostreSQL (MySQL or any other major player) as in-memory database?

If postresql/mysql is not a way-to-go – are there any other C-heavily-optimized data structures with a query language on top of it? (with/without a ruby binding).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:29:47+00:00Added an answer on June 17, 2026 at 8:29 pm

    First of all, SQLite does support bulk inserts using following methods:

    • Poor man’s replacement for multi-valued INSERT:

      INSERT INTO mytable (a,b,c) SELECT 1 a, 2 b, 'x' c 
                        UNION ALL SELECT 2,   5,   'y' 
                        UNION ALL SELECT 3,   7,   'z'
                    ...
      
    • True multi-valued INSERT, supported since SQLite 3.7.11:

      INSERT INTO mytable (a,b,c) VALUES (1,2,'x'),
                                         (2,5,'y'),
                                         (3,7,'z');
      
    • Using transactions:

      BEGIN;
      INSERT INTO mytable (a,b,c) VALUES (1,2,'x');
      INSERT INTO mytable (a,b,c) VALUES (2,5,'y');
      INSERT INTO mytable (a,b,c) VALUES (3,7,'z');
      COMMIT;
      

    If you ask how to translate these into Ruby or Ruby on Rails – I admit, I have no idea, but I guess it should be possible.

    But, even if SQLite did not support these methods, for in-memory database nothing of this should really matter – because if it is really all in-memory, insert speed should not really depend whether you insert rows one by one or as one transaction. Your speed limit is really just raw memory copy bandwidth.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our application needs a simple scheduling mechanism - we can schedule only one visit
I need to make a column unique in one of our database tables, and
In one of our applications we need to call the Yahoo Soap Webservice to
I need to call Ghostscript in one of our cgi to convert a PDF
I need to set up a payment solution within one of our Rails apps
We are using Linq-to-SQL with stored Procedures we need help on one of our
As part of one our system's we enable a user in the backoffice to
One of our servers has 4 gb of data. But as of now i
One of our products contains multiple WCF services whose business layers all sit on
One of our staff members has lost his mailbox but luckily has a dump

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.