Tagged Questions
34
votes
4answers
2k views
Improving Postgres psycopg2 query performance for Python to the same level of Java's JDBC driver
Overview
I'm attempting to improve the performance of our database queries for SQLAlchemy. We're using psycopg2. In our production system, we're chosing to go with Java because it is simply faster ...
26
votes
13answers
34k views
How to get a value from the last inserted row?
Is there some way to get a value from the last inserted row?
I am inserting a row where the PK will automatically increase, and I would like to get this PK. Only the PK is guaranteed to be unique in ...
15
votes
3answers
11k views
Why are batch inserts/updates faster? How do batch updates work?
Why are batch inserts faster? Is it because the connection and setup overhead for inserting a single row is the same for a set of rows? What other factors make batch inserts faster?
How do batch ...
11
votes
4answers
2k views
Tips on Speeding up JDBC writes?
I am writing a program that does a lot of writes to a Postgres database. In a typical scenario I would be writing say 100,000 rows to a table that's well normalized (three foreign integer keys, the ...
10
votes
5answers
24k views
Postgres JDBC connection in Eclipse Help
I'm trying to get a postgres jdbc connection working in eclipse. It would be nice to use the Data Source Explorer, but for now I'm just trying to get a basic connection. What I have done so far is ...
10
votes
5answers
6k views
Where can I find the PostGresql 9.2 JDBC 4 drivers in a maven repo?
Looking at the maven central repository the newest jdbc4 driver available for PostGresql is only the 9.1 driver
http://mvnrepository.com/artifact/postgresql/postgresql/9.1-901.jdbc4
There is a newer ...
10
votes
2answers
8k views
Postgresql, JDBC, and streaming BLOBs
I am trying to retrieve a blob from a postgres database using the jdbc drivers. It is too big to have in memory so I want to stream it as a download. I tried using the getBinaryStream method on ...
10
votes
1answer
2k views
Any halfway decent jdbc wrappers for Scala?
I'm looking for a stripped down (so NOT like squeryl, or anything that creates typesafe queries where I have to respecify the table just to get some data) wrapper for jdbc.
i'm using scala 2.9 and ...
10
votes
2answers
918 views
Java queries against PGPool II cause “unnamed prepared statement does not exist” errors
I have a Java app that uses a Postgres database and I'm trying to introduce PGPool in order to scale up my database. I'm running into a problem where Postgres throws the following error: unnamed ...
9
votes
2answers
149 views
JDBC what's the purpose of PreparedStatement#setNull
I did an experiment with a table having a VARCHAR column with null values trying to get the number of rows that have a specific column NULL. I used three forms:
form A
SELECT COUNT(*) FROM buyers ...
8
votes
4answers
11k views
Is it possible to specify schema when connecting to postgres with JDBC?
Is it possible? Can i specify it on the connection URL? How to do that?
8
votes
3answers
4k views
JDBC postgres query with a timeout
Unfortunately setTimeout is not implemented for JDBC/postgres. Is there some way I can simulate or workaround this? Functionally I want to execute the query and the then break if it takes longer ...
8
votes
5answers
10k views
How to set list of parameters on prepared statement?
i have a list of names e.g.:
List<String> names = ...
names.add('charles');
...
and a statement:
PreparedStatement stmt =
conn.prepareStatement('select * from person where name in ( ? ...
8
votes
2answers
166 views
Does the JDBC spec prevent '?' from being used as an operator (outside of quotes)?
From Sam Macbeth's question:
Is there anything in the JDBC spec which allows a ? to be escaped and be anything other than a parameter placeholder?
For example, Postgres allows you to use ? as an ...
7
votes
5answers
14k views
JDBC: How to read all rows from huge table?
I have a problem to process all rows from database (PostgreSQL). I get error: "org.postgresql.util.PSQLException: Ran out of memory retrieving query results.". I thing that i need to read all rows in ...