Re: Multi Inserts in CREATE TABLE AS - revived patch

Поиск
Список
Период
Сортировка
Искать
От
Bharath Rupireddy
Тема
Re: Multi Inserts in CREATE TABLE AS - revived patch
Дата
Msg-id
CALj2ACWr79He4pDOWb5nYh45pW0u7z_K32g0Ub85BK_LUFoqNw@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Paul Guo <guopa@vmware.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Paul Guo <guopa@vmware.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Heikki Linnakangas <hlinnaka@iki.fi>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Luc Vlaming <luc@swarm64.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Michael Paquier <michael@paquier.xyz>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Luc Vlaming <luc@swarm64.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Luc Vlaming <luc@swarm64.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Luc Vlaming <luc@swarm64.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Dilip Kumar <dilipbalaut@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Simon Riggs <simon@2ndquadrant.com>
Re: Multi Inserts in CREATE TABLE AS - revived patch Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Few things:

IIUC Andres mentioned similar kinds of APIs earlier in [1].


I would like to add some more info to one of the API:

typedef struct MultiInsertStateData
{
    MemoryContext         micontext; /* A temporary memory context for multi insert. */
    BulkInsertStateData *bistate;   /* Bulk insert state. */
    TupleTableSlot      **mislots; /* Array of buffered slots. */
    uint32              nslots; /* Total number of buffered slots. */
    int64              nbytes; /* Flush buffers if the total tuple size >= nbytes. */
    int32              nused; /* Number of current buffered slots for a multi insert batch. */
    int64              nsize; /* Total tuple size for a multi insert batch. */  
} MultiInsertStateData;

/* Creates a temporary memory context, allocates the MultiInsertStateData, BulkInsertStateData and initializes other members. */
    void        (*begin_multi_insert) (Relation rel, MultiInsertStateData **mistate, uint32 nslots, uint64 nbytes);

/* Buffers the input slot into mistate slots, computes the size of the tuple, and adds it total buffer tuple size, if this size crosses mistate->nbytes, flush the buffered tuples into table. For heapam, existing heap_multi_insert can be used. Once the buffer is flushed, then the micontext can be reset and buffered slots can be cleared. If nbytes i.e. total tuple size of the batch is not given, tuple size is not calculated, tuples are buffered until all the nslots are filled and then flushed. */
    void        (*do_multi_insert) (Relation rel, MultiInsertStateData *mistate, struct TupleTableSlot *slot, CommandId cid, int options);

/* Flush the buffered tuples if any. For heapam, existing heap_multi_insert can be used. Deletes temporary memory context and deallocates mistate. */    
    void        (*end_multi_insert) (Relation rel, MultiInsertStateData *mistate, CommandId cid, int options);

With Regards,
Bharath Rupireddy.
В списке pgsql-hackers по дате отправления
От: Alexander Korotkov
Дата:
От: Amit Kapila
Дата:
FAQ