Code Monkey home page Code Monkey logo

Comments (6)

bwtakacy avatar bwtakacy commented on July 17, 2024

Hi,

-->Pg_bulkload is more like Sql loader in Oracle right? What if the table has indexes. Will it be rebuild after loading data as like oracle? Not sure, how this process works.

Yes, the indexes are rebuilt after loading data, not to updating indexes in insertition.

-->In pg_bulkloads, records will be inserted not updated. right?
Came across, few records got replaced. Is it because of ON_DUPLICATE_KEEP = NEW. Will that be be updated, or record will be removed and re-inserted. Kindly clarify that.

Yes, load records are inserted, not updated.
In default configuration,ON_DUPLICATE_KEEP does not work because DUPLICATE_ERRORS is non zero.
Could you tell us the situation more detail?

from pg_bulkload.

rajmhnr avatar rajmhnr commented on July 17, 2024

Thanks.

This is my case, where records got replaced and i have a settings as

DUPLICATE_ERRORS = 0
ON_DUPLICATE_KEEP = NEW

This is normal.right? If any record was already present, that particular record will be replaced by a record from source.

I have one more question. Will pg_bulkload disable the trigger before loading? I don't want to disable the trigger.

from pg_bulkload.

bwtakacy avatar bwtakacy commented on July 17, 2024

This is normal.right? If any record was already present, that particular record will be replaced by a record from source.

Yes, that is the default configuration.
I think that pg_bulkload will abort if there is duplicated records in this configuration like below.

$ pg_bulkload sample_csv.ctl 
NOTICE: BULK LOAD START
ERROR: query failed: ERROR:  could not create unique index "foo_pkey"
DETAIL:  Key (a)=(1) is duplicated.
DETAIL: query was: SELECT * FROM pg_bulkload($1)

I have one more question. Will pg_bulkload disable the trigger before loading? I don't want to disable the trigger.

Yes, pg_bulkload does not call triggers.

from pg_bulkload.

rajmhnr avatar rajmhnr commented on July 17, 2024

Thanks.

We created partitioned table based on month or day.

Based on the process date in source file, trigger will look whether the partitioned was already present, if not, will create a partition and load the data.That's essential from our side.

Any other workaround for this using pg_bulkload.

from pg_bulkload.

bwtakacy avatar bwtakacy commented on July 17, 2024

Because pg_bulkload does not use triggers, you should prepare data files for each partition tables and load each files into each partition tables by pg_bulkload.

from pg_bulkload.

rajmhnr avatar rajmhnr commented on July 17, 2024

Thanks

from pg_bulkload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.