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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:37:11+00:00 2026-06-03T15:37:11+00:00

In Oracle OCI and OCCI there are API facilities to perform array inserts where

  • 0

In Oracle OCI and OCCI there are API facilities to perform array inserts where you build up an array of values in the client and send this array along with a prepared statement to the server to insert thousands of entries into a table in a single shot resulting in huge performance improvements in some scenarios. Is there anything similar in PostgreSQL ?

I am using the stock PostgreSQL C API.

Some pseudo code to illustrate what i have in mind:

stmt = con->prepare("INSERT INTO mytable VALUES ($1, $2, $3)");
pg_c_api_array arr(stmt);
for triplet(a, b, c) in mylongarray:
    pg_c_api_variant var = arr.add();
    var.bind(1, a);
    var.bind(2, b);
    var.bind(3, c);
stmt->bindarray(arr);
stmt->exec()
  • 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-03T15:37:13+00:00Added an answer on June 3, 2026 at 3:37 pm

    PostgreSQL has similar functionality – statement COPY and COPY API – it is very fast

    libpq documentation

    char *data = "10\t20\40\n20\t30\t40";
    
    pres = PQexec(pconn, "COPY mytable FROM stdin");
    
    /* can be call repeatedly */ 
    copy_result = PQputCopyData(pconn, data, sizeof(data));
    if (copy_result != 1)
    {
            fprintf(stderr, "Copy to target table failed: %s\n",
                                            PQerrorMessage(pconn));
            EXIT;
    }
    
    if (PQputCopyEnd(pconn, NULL) == -1)
    {
             fprintf(stderr, "Copy to target table failed: %s\n",
                                                PQerrorMessage(pconn));
                                EXIT;
    }
    
    pres = PQgetResult(pconn);
    if (PQresultStatus(pres) != PGRES_COMMAND_OK)
    {
           fprintf(stderr, "Copy to target table failed:%s\n",
                                                PQerrorMessage(pconn));
               EXIT;
    }
    
    PQclear(pres);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is a cursor created with oopen (from the Oracle 7.x OCI api) forward-only and
Currently i am using ODP.Net.Is Oracle Instant client something to replace this or an
Is there any way to set a timeout on Oracle OCI calls (OCIStmtExecute for
i use below DLL to connect direct to oracle from client. oci.dll, Oracle.DataAccess.dll, oraociicus11.dll,
I'm puzzled about the correct use of bind variables with dates in Oracle. This
I currently make an Oracle connection like this: $c = oci_connect('username', 'password', 'host'); which
I'm debugging a Java App, which connects to Oracle DB via a thin client.
When I execute a fetch from an Oracle database using PHP OCI, numbers that
I'm using Ocilib to perform a bulk insert on a Oracle database but I'm
Im using the OCI libraries from oracle 9i(personal edtn) for connecting to the database

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.