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 6191543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:47:02+00:00 2026-05-24T02:47:02+00:00

I have a mysql db with several tables, let’s call them Table1, Table2, etc.

  • 0

I have a mysql db with several tables, let’s call them Table1, Table2, etc. I have to make several calls to each of these tables

Which is most efficient,

a) Collecting all queries for each table in one message, then executing them separately, e.g.:

INSERT INTO TABLE1 VALUES (A,B);
INSERT INTO TABLE1 VALUES (A,B);

…execute

INSERT INTO TABLE2 VALUES (A,B);
INSERT INTO TABLE2 VALUES (A,B);

…execute

b) Collecting ALL queries in one long message(not in order of table), then executing this query, e.g:

INSERT INTO TABLE1 VALUES (A,B);
INSERT INTO TABLE2 VALUES (B,C);
INSERT INTO TABLE1 VALUES (B,A);
INSERT INTO TABLE3 VALUES (D,B);

c) Something else?

Currently I am doing it like option (b), but I am wondering if there is a better way.

(I am using jdbc to access the db, in a groovy script).

Thanks!

  • 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-05-24T02:47:03+00:00Added an answer on May 24, 2026 at 2:47 am

    Rather than looking at which is more efficient, first consider whether the tables are large and whether you need concurrency.

    If they are (millions of records) then you may want to separate them on a statement to statement basis and give some time between each statement, so you will not lock the table for too long at a time.

    If your table isn’t that large or concurrency is not a problem, then by all means do whichever. You should look at the slow logs of the statements and see which statement is faster.

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

Sidebar

Related Questions

Let's say we have system A comprising a MySQL database, with several tables. After
I have a database with several tables. Each of these tables has a column
I have two tables (let's call them A and B) with same structure and
I'm trying to write a MySQL script that creates several tables. I have: CREATE
I have a mysql database which contains several tables. At the moment i'm using
I have two MySQL databases with identical table structure, each populated with several thousand
I have several MySQL tables with the same structure. They all have a date
I have data split across several mysql tables to prevent data duplication but joining
I have several mysql tables in a database. Currently I am doing finishing test
I have some MySQL databases that have several tables that contain (amongst others) some

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.