pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lendvary Gyorgy <gyurika@prolan.hu>
To: pgsql-sql@postgresql.org
Subject: questions
Date: Tue, 09 Jun 1998 14:01:39 +0200
Message-ID: <357D2423.52EEFBA0@prolan.hu> (raw)

I have a little problem with arrays. I,ve defined a type dbref. It has
two fields: char type[200] and char record[200]. My prolem is that I
can't insert a row into a table which has an attribute with type
dbref[2].
For instance:
Create table boci (hapci dbref[2]);
How can I insert a row into this table?
Please help me!

	My next problem is SPI interface. I have used LIBPQ but I need SPI. I
have read a description in PostgrSQL Programmer's Guide, but I
understand nearly nothing. Please write me where I can find a better
description about SPI!

	I have to treat very big tables from my C program. I update every
attribute with update command. When I update an attribute, I must go
through every tuple of the table. It takes a long time. I write you a
little piece of my program:

sprintf(buff, "CREATE TABLE boci (tup_num int, hapci int)");
PQexec(conn, buff);
for (i=0; i<10000; i++)
{
    sprintf(buff, "INSERT INTO boci VALUES(i)");
    PQexec(conn, buff);
}

for (i=0; i<10000; i++)
{
    x = GetValue(); /* GetValue isn't an interesting function */
    sprintf(buff, "UPDATE boci SET hapci = %d WHERE tup_num = %d", x,
i);
    PQexec(conn, buff);
}

I don't want to update every tuple indvidually but I want to prepare a
'block write'. I hope you understand what I'd like to.
Can you give me a good method for saving a long time? I need a program
that is about 10 times faster than mine.

Thanks for your attention!

gyurika@prolan.hu



view thread (2+ messages)  latest in thread

Message-ID: <357D2423.52EEFBA0@prolan.hu>
Permalink:  ../357D2423.52EEFBA0@prolan.hu/
Also on:    postgresql.org/message-id/357D2423.52EEFBA0@prolan.hu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gyurika@prolan.hu
  Subject: Re: questions
  In-Reply-To: <357D2423.52EEFBA0@prolan.hu>
  References: <357D2423.52EEFBA0@prolan.hu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox