lo_import problem

Поиск
Список
Период
Сортировка
От Michael Meskes
Тема lo_import problem
Дата
Msg-id 19981113113238.A1920@usa.net
обсуждение исходный текст
Список pgsql-hackers
I've just been send the following problem report:

> >1.  To store the data file I am using  lo_import function of large
> >object interface. As I  am storing(importing into database) the file
> >even 100 bytes only. During the importing process it creates two files
> >into the database area xinv*,xinx* .I don't know why it is taking  the
> >space of  16384 Bytes for each xinv* xinx* file  in the database.
> >    This much space consumption is unmanageable. Please help me.
> >Actually how this import the file I don't know.
> >Thanks alot
> ...

I am sending a sample source code.    1  #include <stdio.h>    2  #include "libpq-fe.h"    3  #include <stdlib.h>    4
charshotno[10];    5  main()    6  {    7  char filename[35];    8  char
*pghost,*pgport,*pgoptions,*pgtty,query2[100];   9  char    *dbName, shotno[10];   10  PGconn *conn;   11  PGresult
*res2;  12  int   shot,gchno;   13  pghost = "sun9";        /* host name of the backend server */   14  pgport =
"5432";       /* port of the backend server */   15  pgoptions = NULL;       /* special options to start up the backend
*/  16  pgtty = NULL;           /* debugging tty for the backend server */   17  dbName = "aditya";   18  /* make a
connectionto the database */   19          conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);   20  /* check to
seethat the backend connection was successfully made */   21  if (PQstatus(conn) == CONNECTION_BAD)   22  {   23
 fprintf(stderr,"Connection to database '%s' failed.\n", dbName);   24          fprintf(stderr,"%s",
PQerrorMessage(conn));  25          exit(0);   26  }   27  printf("\nEnter the shot no... ");   28  scanf("%s",shotno);
 29  shot=atoi(shotno);   30  gchno=200;   31  filename="/users13/aditya/vax/a05966.lgg";   32  sprintf(query2,"insert
intoch_data values ( %d ,%d , lo_import('%s')) ; " , shot ,gchno , filename);   33  res2 = PQexec(conn,query2);   34  }
 35  printf("\n The Data File For This Shot has transferred 'OK' \n");   36  }
 
--
In this code the file I am importing  "/users13/aditya/vax/a05966.lgg"
has a size of 3328 bytes only. This file consumes the space in database
is of 2*16384 bytes. It creates two files xinv* and xinx* in database of
size 16384 bytes each.

sun9:/work/postgres/local/data/base/aditya>$ ls -laF
-rw-------   1 postgres guest      16384 Nov 12 10:37 xinx154230
-rw-------   1 postgres guest      16384 Nov 12 10:37 xinv154230
How can I reduce the size of the file in database.                H.K.Gulati
hkg@plasma.ernet.in               Engineer - SC                Institute For Plasma Research                Bhat
Gandhinagar(GUJARAT)

Michael

-- 
Dr. Michael Meskes, Manager of the Western Branch Office, Datenrevision GmbH
work: Cuxhavener Str. 36, D-21149 Hamburg
home: Th.-Heuss-Str. 61,  D-41812 Erkelenz, Michael.Meskes@usa.net
Go SF49ers! Go Rhein Fire! Use Debian GNU/Linux!




В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Jackson, DeJuan"
Дата:
Сообщение: RE: [HACKERS] shmem limits and redolog
Следующее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] More CORBA and PostgreSQL