Обсуждение: performance issues

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

performance issues

От
jguthrie@air.org
Дата:
i (and co-workers) am trying to get the best performance out of jdbc
inserting into a specific table (the rest of my app can suffer if it
improves performance here). a couple of issues i have come across
though, where i would welcome advice:

1) batches - we are thinking that we can save time by batching up,
say, 10 inserts and using Statement.executeBatch(). the problem here
is that executeBatch wants a nice sql statement String, whereas we are
currently using PreparedStatements. and we are using
PreparedStatements because we are inserting binary data (using
setByteArray() to load a pg bytea field). so is there a way to:
  - use PreparedStatements in a batch environment?
  - insert binary data in a String format?

2) indexes - the table has a primary key, so it has an index. one
   bright idea i got was to drop the primary key, thus saving time by
   not doing all the index work. surprisingly, this seems to have no
   effect at all. does this make sense?

thanks. again, all ideas welcome.
john guthrie

Re: performance issues

От
Dave Cramer
Дата:
Someone implemented the copy function in jdbc, grep through the archives
to find the details.

And definately drop the index, do the inserts, and rebuild the index.

Dave
On Thu, 2002-12-05 at 11:44, jguthrie@air.org wrote:
> i (and co-workers) am trying to get the best performance out of jdbc
> inserting into a specific table (the rest of my app can suffer if it
> improves performance here). a couple of issues i have come across
> though, where i would welcome advice:
>
> 1) batches - we are thinking that we can save time by batching up,
> say, 10 inserts and using Statement.executeBatch(). the problem here
> is that executeBatch wants a nice sql statement String, whereas we are
> currently using PreparedStatements. and we are using
> PreparedStatements because we are inserting binary data (using
> setByteArray() to load a pg bytea field). so is there a way to:
>   - use PreparedStatements in a batch environment?
>   - insert binary data in a String format?
>
> 2) indexes - the table has a primary key, so it has an index. one
>    bright idea i got was to drop the primary key, thus saving time by
>    not doing all the index work. surprisingly, this seems to have no
>    effect at all. does this make sense?
>
> thanks. again, all ideas welcome.
> john guthrie
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
Dave Cramer <Dave@micro-automation.net>