[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Postgres Access Timing
- Subject: Re: Postgres Access Timing
- From: beamends <..hidden..>
- Date: Fri, 24 Jul 2009 15:43:04 +0100
On Fri, 2009-07-24 at 09:01 -0400, Eric Lucas wrote:
> Richard:
>
> Is this injection part of an ongoing process or just a one-time import
> of data?
>
> If you're only going to do this once then you might want to try
> importing the data by using a spreadsheet to construct the necessary SQL
> INSERT statements. It will load slower than your program would load
> them but depending on the amount data it's tolerable.
>
>
> Here's what I do...
>
> Copy the data into a spreadsheet.
>
> Re-order and/or duplicated the columns of data as necessary for the next
> step
>
> Insert empty columns and place SQL fragments in these new columns
>
> You can create multiple inserts on the same line (for multiple tables
> for example) by separating them with a semi-colon and duplicating
> columns of data as required.
>
> When the syntax is correct then export it as a delimited file (for
> example, delimited by a pipe character: | ).
>
> Use an programmable editor (like VIM, JEdit, bbedit, etc.) to remove all
> the pipe characters and the resulting file can be executed from the
> command line.
> (in VIM I just enter the following command to remove the delimiters
> all at once):
> :%s/|//g
>
>
> You can also insert several sample rows in the tables and then dump them
> them and modify the dump file to contain your entire data set. I
> believe that data is tab-delimited.
>
>
>
> Hope this helps,
>
> Eric
Hi Eric,
sadly it's a monthly thing, updating prices and new parts from two (or
more maybe) suppliers, and checking who's doing the best price this
month.
Dumping the data, updating and then putting back may be an option later
though if I can get this working!
Thanks for the reply!
Cheers
Richard
>
> beamends wrote:
> > Hi All,
> > not strictly a LSMB thing, but as the answer may be of interest to
> > others here goes... (excuse the terminology, I'm not of the dbase expert
> > persuasion)
> >
> >
> > I'm "injecting" data into Postgres using a C program via libpq. From the
> > documentation it's not clear if the various functions check/wait to see
> > if a dbase command has been or can be completed before returning from
> > the function ("locking"?). All is tickety-boo except when creating a new
> > part. When the new part is created the next line is to create the
> > partsvendor table entry. This works ok for most of the time, but will
> > start failing after a while with the INSERT into partsvendor failing.
> > Doing the command from the SQL window in phppgadmin will then work.
> > Presumably this is a timing issue or such. So the question is, is there
> > and SQL or Posgres command to interrogate the dbase to see if it is
> > "ready" for the next command. Or am I barking up the wrong tree
> > entirely!
> >
> > Cheers
> > Richard
> >
> >
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Ledger-smb-users mailing list
> > ..hidden..
> > https://lists.sourceforge.net/lists/listinfo/ledger-smb-users
> >
>