Обсуждение: Problems doing a copy to a table

Поиск
Список
Период
Сортировка

Problems doing a copy to a table

От
"Chris Williams"
Дата:
I am creating a text file to do file dumps into postgres using the copy command.  The copy command
executes fine but when I do a count on the table, I get zero records.  But when I do a vacuum
command on that table, here is what is says

sdbm=> vacuum verbose D_TERM_APPROACH;
NOTICE:  --Relation d_term_approach--
NOTICE:  Pages 490: Changed 0, Reapped 490, Empty 0, New 0; Tup 0: Vac 11530, Crash 11530, UnUsed 0,
MinLen 0, MaxLen 0; Re-using: Free/Avail. Space 3964040/0; EndEmpty/Avail. Pages 490/0. Elapsed 0/1
sec.
NOTICE:  Rel d_term_approach: Pages: 490 --> 0.

I know the 11530 is the correct number of tuples that should have been added to the table.  Any
ideas on what may be happening or how I can debug this problem.  I am using version 6.4 on Solaris
2.5.1.
Thanks
---------
Chris Williams
Sterling Software
Rome, New York
Phone: (315) 336-0500
Email: chris_d_williams@sterling.com



Re: [HACKERS] Problems doing a copy to a table

От
jwieck@debis.com (Jan Wieck)
Дата:
Chris Williams wrote:

>
> I am creating a text file to do file dumps into postgres using the copy command.  The copy command
> executes fine but when I do a count on the table, I get zero records.  But when I do a vacuum
> command on that table, here is what is says
>
> sdbm=> vacuum verbose D_TERM_APPROACH;
> NOTICE:  --Relation d_term_approach--
> NOTICE:  Pages 490: Changed 0, Reapped 490, Empty 0, New 0; Tup 0: Vac 11530, Crash 11530, UnUsed 0,
> MinLen 0, MaxLen 0; Re-using: Free/Avail. Space 3964040/0; EndEmpty/Avail. Pages 490/0. Elapsed 0/1
> sec.
> NOTICE:  Rel d_term_approach: Pages: 490 --> 0.
>
> I know the 11530 is the correct number of tuples that should have been added to the table.  Any
> ideas on what may be happening or how I can debug this problem.  I am using version 6.4 on Solaris
> 2.5.1.

    The  notice  about  'Crash  11530' tells that the copy didn't
    execute as fine as you thought. Don't know  what  causes  the
    crash  though as long as I can't see some part of what you're
    trying to copy in.

    But as a matter of fact,  the  backend  copying  in  must  do
    something  very  bad  at  the  end  of  it's  COPY.  Thus the
    transaction doesn't commit correctly and vacuum  just  whipes
    out  the data which came from a crashed transaction. Whithout
    a correct committed transaction, your whole approach is a big
    noop.

    Please  try  to  reproduce the error with a smaller amount of
    (maybe anonymized data) and give a  reproducable  example  of
    what  you're  in detail do (table schema, test-data and exact
    copy command).


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #