Re: Input and Output data traffic
От | Israel Ben Guilherme Fonseca |
---|---|
Тема | Re: Input and Output data traffic |
Дата | |
Msg-id | BANLkTi=hDAHCbReyZ+GXKJ_Q4=Z5t2YzhA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Input and Output data traffic (Karsten Hilbert <Karsten.Hilbert@gmx.net>) |
Ответы |
Re: Input and Output data traffic
(Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Re: Input and Output data traffic (Karsten Hilbert <Karsten.Hilbert@gmx.net>) Re: Input and Output data traffic (Karsten Hilbert <Karsten.Hilbert@gmx.net>) |
Список | psycopg |
I'm not with java code right now, but the python one is this:
def inserir(self, curso):
cursor = self.conn.cursor()
cursor.execute("""insert into Curso(area, carga_horaria, ementa, nome)
values(%s, %s, %s, %s)""",
(curso.area, curso.carga_horaria, curso.ementa, curso.nome))
cursor.close()
self.conn.commit()
- Simple insert, without returning.
- With a proxy between application and database i measured the quantity of transfered data.
- Executed 1000 times.
Note: I tried to reuse the same cursor (instead of creating a new one every time) and didn't get any significant change.
About server side cursors, I thought that it would only matter for select statements. Wouldn't? Is it possible to implement this differently?
def inserir(self, curso):
cursor = self.conn.cursor()
cursor.execute("""insert into Curso(area, carga_horaria, ementa, nome)
values(%s, %s, %s, %s)""",
(curso.area, curso.carga_horaria, curso.ementa, curso.nome))
cursor.close()
self.conn.commit()
- Simple insert, without returning.
- With a proxy between application and database i measured the quantity of transfered data.
- Executed 1000 times.
Note: I tried to reuse the same cursor (instead of creating a new one every time) and didn't get any significant change.
About server side cursors, I thought that it would only matter for select statements. Wouldn't? Is it possible to implement this differently?
2011/5/11 Karsten Hilbert <Karsten.Hilbert@gmx.net>
On Wed, May 11, 2011 at 08:18:40AM -0300, Israel Ben Guilherme Fonseca wrote::-) That makes better sense now.
> LOL, sorry I wasn't explicit in my text. But i did the same test with
> psycopg2 too. :P...
> "For simple inserts/updates/deletes i got a difference of about 15% between
> sent and received data."It very much depends on the exact queries used:
> If someone could say: "well, sent/received data should be significantly
> different and there is something wrong there", or "no it's normal". That
> would be helpful.
1) INSERT INTO my_table (a, b) VALUES (1, 2);
2) INSERT INTO my_table (a, b) VALUES (1, 2) RETURNING a, b;
I would expect a lot more data to be returned with 2) than
with 1).
(That difference in testing setup does not explain the
differences between drivers, though, if one assumes you've
been using the very same queries with each.)
The other thing is that one driver may be using server-side
cursors while another driver will use client-side cursors.
The latter will transfer a lot more data.
I think you'd have to be more specific about the exact
testing methodology to get useful advice.
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
--
Sent via psycopg mailing list (psycopg@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/psycopg
В списке psycopg по дате отправления: