pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedsetFetchSize
40+ messages / 16 participants
[nested] [flat]
* setFetchSize
@ 2002-08-28 08:33 Daniel Stern <daniel.stern@teconomic.ch>
0 siblings, 0 replies; 40+ messages in thread
From: Daniel Stern @ 2002-08-28 08:33 UTC (permalink / raw)
To: pgsql-jdbc
Hello
I'd like to know, if anybody is implementing setFetchSize ( scrollable
cursors ) on the jdbc-Statement. I think that's
An important feature especially for batch-processing.
Thanks
Daniel Stern
^ permalink raw reply [nested|flat] 40+ messages in thread
* setFetchSize
@ 2002-10-01 16:43 snpe <snpe@snpe.co.yu>
0 siblings, 0 replies; 40+ messages in thread
From: snpe @ 2002-10-01 16:43 UTC (permalink / raw)
To: pgsql-jdbc
Hello,
Postgresql JDBC work now with JDeveloper.
It is only problem with fetch size in resultset.If I have big tables I get
'out of memory'
Is setFetchSize planned for pgsql jdbc and is it hard for implementation ?
regards
haris peco
^ permalink raw reply [nested|flat] 40+ messages in thread
* setFetchSize
@ 2003-07-17 13:24 Felipe Schnack <felipes@ritterdosreis.br>
0 siblings, 2 replies; 40+ messages in thread
From: Felipe Schnack @ 2003-07-17 13:24 UTC (permalink / raw)
To: pgsql-jdbc
There is a way that I can set setFetchSize() that will prevent pgsql from caching all the results of a query to server's memory?
I'm trying to search in the archives but any search I try returns 0 results...
--
/~\ The ASCII Felipe Schnack (felipes@ritterdosreis.br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893
Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2003-07-17 13:31 Fernando Nasser <fnasser@redhat.com>
parent: Felipe Schnack <felipes@ritterdosreis.br>
1 sibling, 0 replies; 40+ messages in thread
From: Fernando Nasser @ 2003-07-17 13:31 UTC (permalink / raw)
To: Felipe Schnack <felipes@ritterdosreis.br>; +Cc: pgsql-jdbc
Felipe Schnack wrote:
> There is a way that I can set setFetchSize() that will prevent pgsql from caching all the results of a query to server's memory?
> I'm trying to search in the archives but any search I try returns 0 results...
>
Have you tried setting it to a positive value and turning off autocommit
(you must be inside a transaction to do this)?
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2003-07-17 15:38 Paul Thomas <paul@tmsl.demon.co.uk>
parent: Felipe Schnack <felipes@ritterdosreis.br>
1 sibling, 0 replies; 40+ messages in thread
From: Paul Thomas @ 2003-07-17 15:38 UTC (permalink / raw)
To: Felipe Schnack <felipes@ritterdosreis.br>; +Cc: pgsql-jdbc
On 17/07/2003 14:24 Felipe Schnack wrote:
> There is a way that I can set setFetchSize() that will prevent pgsql
> from caching all the results of a query to server's memory?
> I'm trying to search in the archives but any search I try returns 0
> results...
Not AFAIK. A work-round might be to use limit and offset in your sql.
HTH
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+
^ permalink raw reply [nested|flat] 40+ messages in thread
* setFetchSize()
@ 2003-07-17 16:46 Rich Cullingford <rculling@sysd.com>
0 siblings, 1 reply; 40+ messages in thread
From: Rich Cullingford @ 2003-07-17 16:46 UTC (permalink / raw)
To: pgsql-jdbc
All,
Will this function be implemented in Release 7.4? I have several arge
tables that run Java out of memory when I attempt to load them through
JDBC. Any workarounds arppreciated...
Rich Cullingford
rculling@sysd.com
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 17:01 Felipe Schnack <felipes@ritterdosreis.br>
parent: Dmitry Tkach <dmitry@openratings.com>
0 siblings, 1 reply; 40+ messages in thread
From: Felipe Schnack @ 2003-07-17 17:01 UTC (permalink / raw)
To: Dmitry Tkach <dmitry@openratings.com>; +Cc: Rich Cullingford <rculling@sysd.com>; pgsql-jdbc
Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
On Thu, 17 Jul 2003 13:01:43 -0400
Dmitry Tkach <dmitry@openratings.com> wrote:
> Rich Cullingford wrote:
>
> > All,
> > Will this function be implemented in Release 7.4? I have several arge
> > tables that run Java out of memory when I attempt to load them through
> > JDBC. Any workarounds arppreciated...
>
> I was using cursors for a while as a workaround...
> Something like this:
>
> c.setAutocommit (false);
> Statement s = c.createStatement ();
> s.execute ("declare foo cursor for select * from bar");
>
> while (true)
> {
> ResultSet rs = s.executeQuery ("fetch 10 from foo");
> int count = 0;
> while (rs.next ())
> {
> count++;
> doStuffWithThisRow (rs);
> }
>
> if (count < 10) //The whole cursor contents has been processed
> break;
> }
>
>
> I hope, it helps...
>
> Dima
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
/~\ The ASCII Felipe Schnack (felipes@ritterdosreis.br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893
Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 17:01 Dmitry Tkach <dmitry@openratings.com>
parent: Rich Cullingford <rculling@sysd.com>
0 siblings, 1 reply; 40+ messages in thread
From: Dmitry Tkach @ 2003-07-17 17:01 UTC (permalink / raw)
To: Rich Cullingford <rculling@sysd.com>; +Cc: pgsql-jdbc
Rich Cullingford wrote:
> All,
> Will this function be implemented in Release 7.4? I have several arge
> tables that run Java out of memory when I attempt to load them through
> JDBC. Any workarounds arppreciated...
I was using cursors for a while as a workaround...
Something like this:
c.setAutocommit (false);
Statement s = c.createStatement ();
s.execute ("declare foo cursor for select * from bar");
while (true)
{
ResultSet rs = s.executeQuery ("fetch 10 from foo");
int count = 0;
while (rs.next ())
{
count++;
doStuffWithThisRow (rs);
}
if (count < 10) //The whole cursor contents has been processed
break;
}
I hope, it helps...
Dima
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 17:16 Dmitry Tkach <dmitry@openratings.com>
parent: Felipe Schnack <felipes@ritterdosreis.br>
0 siblings, 1 reply; 40+ messages in thread
From: Dmitry Tkach @ 2003-07-17 17:16 UTC (permalink / raw)
To: Felipe Schnack <felipes@ritterdosreis.br>; +Cc: Rich Cullingford <rculling@sysd.com>; pgsql-jdbc
Felipe Schnack wrote:
> Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
>
>
Because you can only have cursors declared inside a transaction :-(
Dima
>On Thu, 17 Jul 2003 13:01:43 -0400
>Dmitry Tkach <dmitry@openratings.com> wrote:
>
>
>
>>Rich Cullingford wrote:
>>
>>
>>
>>>All,
>>>Will this function be implemented in Release 7.4? I have several arge
>>>tables that run Java out of memory when I attempt to load them through
>>>JDBC. Any workarounds arppreciated...
>>>
>>>
>>I was using cursors for a while as a workaround...
>>Something like this:
>>
>>c.setAutocommit (false);
>>Statement s = c.createStatement ();
>>s.execute ("declare foo cursor for select * from bar");
>>
>>while (true)
>>{
>> ResultSet rs = s.executeQuery ("fetch 10 from foo");
>> int count = 0;
>> while (rs.next ())
>> {
>> count++;
>> doStuffWithThisRow (rs);
>> }
>>
>> if (count < 10) //The whole cursor contents has been processed
>> break;
>>}
>>
>>
>>I hope, it helps...
>>
>>Dima
>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>
>>
>
>
>
>
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 17:19 Felipe Schnack <felipes@ritterdosreis.br>
parent: Dmitry Tkach <dmitry@openratings.com>
0 siblings, 1 reply; 40+ messages in thread
From: Felipe Schnack @ 2003-07-17 17:19 UTC (permalink / raw)
To: Dmitry Tkach <dmitry@openratings.com>; +Cc: Rich Cullingford <rculling@sysd.com>; pgsql-jdbc
but I said I can't understand it when autocommit is off, not when it's on...
On Thu, 17 Jul 2003 13:16:15 -0400
Dmitry Tkach <dmitry@openratings.com> wrote:
> Felipe Schnack wrote:
>
> > Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
> >
> >
> Because you can only have cursors declared inside a transaction :-(
>
> Dima
>
> >On Thu, 17 Jul 2003 13:01:43 -0400
> >Dmitry Tkach <dmitry@openratings.com> wrote:
> >
> >
> >
> >>Rich Cullingford wrote:
> >>
> >>
> >>
> >>>All,
> >>>Will this function be implemented in Release 7.4? I have several arge
> >>>tables that run Java out of memory when I attempt to load them through
> >>>JDBC. Any workarounds arppreciated...
> >>>
> >>>
> >>I was using cursors for a while as a workaround...
> >>Something like this:
> >>
> >>c.setAutocommit (false);
> >>Statement s = c.createStatement ();
> >>s.execute ("declare foo cursor for select * from bar");
> >>
> >>while (true)
> >>{
> >> ResultSet rs = s.executeQuery ("fetch 10 from foo");
> >> int count = 0;
> >> while (rs.next ())
> >> {
> >> count++;
> >> doStuffWithThisRow (rs);
> >> }
> >>
> >> if (count < 10) //The whole cursor contents has been processed
> >> break;
> >>}
> >>
> >>
> >>I hope, it helps...
> >>
> >>Dima
> >>
> >>
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> >>
> >>
> >
> >
> >
> >
>
>
--
/~\ The ASCII Felipe Schnack (felipes@ritterdosreis.br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893
Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 17:25 Dmitry Tkach <dmitry@openratings.com>
parent: Felipe Schnack <felipes@ritterdosreis.br>
0 siblings, 3 replies; 40+ messages in thread
From: Dmitry Tkach @ 2003-07-17 17:25 UTC (permalink / raw)
To: Felipe Schnack <felipes@ritterdosreis.br>; +Cc: Rich Cullingford <rculling@sysd.com>; pgsql-jdbc
Felipe Schnack wrote:
> but I said I can't understand it when autocommit is off, not when it's on...
>
autocommit is off == you are in transaction.
You must be in transaction to be able to declare a cursor.
Dima
>
>On Thu, 17 Jul 2003 13:16:15 -0400
>Dmitry Tkach <dmitry@openratings.com> wrote:
>
>
>
>>Felipe Schnack wrote:
>>
>>
>>
>>> Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
>>>
>>>
>>>
>>>
>>Because you can only have cursors declared inside a transaction :-(
>>
>>Dima
>>
>>
>>
>>>On Thu, 17 Jul 2003 13:01:43 -0400
>>>Dmitry Tkach <dmitry@openratings.com> wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Rich Cullingford wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>All,
>>>>>Will this function be implemented in Release 7.4? I have several arge
>>>>>tables that run Java out of memory when I attempt to load them through
>>>>>JDBC. Any workarounds arppreciated...
>>>>>
>>>>>
>>>>>
>>>>>
>>>>I was using cursors for a while as a workaround...
>>>>Something like this:
>>>>
>>>>c.setAutocommit (false);
>>>>Statement s = c.createStatement ();
>>>>s.execute ("declare foo cursor for select * from bar");
>>>>
>>>>while (true)
>>>>{
>>>> ResultSet rs = s.executeQuery ("fetch 10 from foo");
>>>> int count = 0;
>>>> while (rs.next ())
>>>> {
>>>> count++;
>>>> doStuffWithThisRow (rs);
>>>> }
>>>>
>>>> if (count < 10) //The whole cursor contents has been processed
>>>> break;
>>>>}
>>>>
>>>>
>>>>I hope, it helps...
>>>>
>>>>Dima
>>>>
>>>>
>>>>
>>>>---------------------------(end of broadcast)---------------------------
>>>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
>
>
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 17:31 Felipe Schnack <felipes@ritterdosreis.br>
parent: Dmitry Tkach <dmitry@openratings.com>
2 siblings, 1 reply; 40+ messages in thread
From: Felipe Schnack @ 2003-07-17 17:31 UTC (permalink / raw)
To: Dmitry Tkach <dmitry@openratings.com>; +Cc: Rich Cullingford <rculling@sysd.com>; pgsql-jdbc
Yes, I understand that... that's why I asked why the JDBC driver doesn't automatically use cursos when you have autocommit off and a fetch size
On Thu, 17 Jul 2003 13:25:56 -0400
Dmitry Tkach <dmitry@openratings.com> wrote:
> Felipe Schnack wrote:
>
> > but I said I can't understand it when autocommit is off, not when it's on...
> >
> autocommit is off == you are in transaction.
>
> You must be in transaction to be able to declare a cursor.
>
> Dima
>
> >
> >On Thu, 17 Jul 2003 13:16:15 -0400
> >Dmitry Tkach <dmitry@openratings.com> wrote:
> >
> >
> >
> >>Felipe Schnack wrote:
> >>
> >>
> >>
> >>> Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
> >>>
> >>>
> >>>
> >>>
> >>Because you can only have cursors declared inside a transaction :-(
> >>
> >>Dima
> >>
> >>
> >>
> >>>On Thu, 17 Jul 2003 13:01:43 -0400
> >>>Dmitry Tkach <dmitry@openratings.com> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Rich Cullingford wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>All,
> >>>>>Will this function be implemented in Release 7.4? I have several arge
> >>>>>tables that run Java out of memory when I attempt to load them through
> >>>>>JDBC. Any workarounds arppreciated...
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>I was using cursors for a while as a workaround...
> >>>>Something like this:
> >>>>
> >>>>c.setAutocommit (false);
> >>>>Statement s = c.createStatement ();
> >>>>s.execute ("declare foo cursor for select * from bar");
> >>>>
> >>>>while (true)
> >>>>{
> >>>> ResultSet rs = s.executeQuery ("fetch 10 from foo");
> >>>> int count = 0;
> >>>> while (rs.next ())
> >>>> {
> >>>> count++;
> >>>> doStuffWithThisRow (rs);
> >>>> }
> >>>>
> >>>> if (count < 10) //The whole cursor contents has been processed
> >>>> break;
> >>>>}
> >>>>
> >>>>
> >>>>I hope, it helps...
> >>>>
> >>>>Dima
> >>>>
> >>>>
> >>>>
> >>>>---------------------------(end of broadcast)---------------------------
> >>>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
/~\ The ASCII Felipe Schnack (felipes@ritterdosreis.br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893
Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 17:41 Dmitry Tkach <dmitry@openratings.com>
parent: Felipe Schnack <felipes@ritterdosreis.br>
0 siblings, 0 replies; 40+ messages in thread
From: Dmitry Tkach @ 2003-07-17 17:41 UTC (permalink / raw)
To: Felipe Schnack <felipes@ritterdosreis.br>; +Cc: Rich Cullingford <rculling@sysd.com>; pgsql-jdbc
Felipe Schnack wrote:
> Yes, I understand that... that's why I asked why the JDBC driver doesn't automatically use cursos when you have autocommit off and a fetch size
>
>
Because it was never implemented, I suppose...
Here is what 7.3 code looks like:
public void setFetchSize(int rows) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
:-)
Dima
>On Thu, 17 Jul 2003 13:25:56 -0400
>Dmitry Tkach <dmitry@openratings.com> wrote:
>
>
>
>>Felipe Schnack wrote:
>>
>>
>>
>>> but I said I can't understand it when autocommit is off, not when it's on...
>>>
>>>
>>>
>>autocommit is off == you are in transaction.
>>
>>You must be in transaction to be able to declare a cursor.
>>
>>Dima
>>
>>
>>
>>>On Thu, 17 Jul 2003 13:16:15 -0400
>>>Dmitry Tkach <dmitry@openratings.com> wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Felipe Schnack wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>Because you can only have cursors declared inside a transaction :-(
>>>>
>>>>Dima
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>On Thu, 17 Jul 2003 13:01:43 -0400
>>>>>Dmitry Tkach <dmitry@openratings.com> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Rich Cullingford wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>All,
>>>>>>>Will this function be implemented in Release 7.4? I have several arge
>>>>>>>tables that run Java out of memory when I attempt to load them through
>>>>>>>JDBC. Any workarounds arppreciated...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>I was using cursors for a while as a workaround...
>>>>>>Something like this:
>>>>>>
>>>>>>c.setAutocommit (false);
>>>>>>Statement s = c.createStatement ();
>>>>>>s.execute ("declare foo cursor for select * from bar");
>>>>>>
>>>>>>while (true)
>>>>>>{
>>>>>> ResultSet rs = s.executeQuery ("fetch 10 from foo");
>>>>>> int count = 0;
>>>>>> while (rs.next ())
>>>>>> {
>>>>>> count++;
>>>>>> doStuffWithThisRow (rs);
>>>>>> }
>>>>>>
>>>>>> if (count < 10) //The whole cursor contents has been processed
>>>>>> break;
>>>>>>}
>>>>>>
>>>>>>
>>>>>>I hope, it helps...
>>>>>>
>>>>>>Dima
>>>>>>
>>>>>>
>>>>>>
>>>>>>---------------------------(end of broadcast)---------------------------
>>>>>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 2: you can get off all lists at once with the unregister command
>> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>
>>
>
>
>
>
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 19:12 Dmitry Tkach <dmitry@openratings.com>
0 siblings, 0 replies; 40+ messages in thread
From: Dmitry Tkach @ 2003-07-17 19:12 UTC (permalink / raw)
To: pgsql-jdbc
This is a multi-part message in MIME format.
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 19:19 Dmitry Tkach <dmitry@openratings.com>
0 siblings, 1 reply; 40+ messages in thread
From: Dmitry Tkach @ 2003-07-17 19:19 UTC (permalink / raw)
To: pgsql-jdbc
Felipe Schnack wrote:
> How are patches being applied to pgsql driver? I would like to implement any new feature to it... but months ago I sent a patch to implement the "DEFAULT" keyword, introduced in pgsql 7.3. The problem is that the last time I checked it still wasn't on the official sources... and it wasn't a long time ago.
> This really made me lost the will to help :-(
>
Same here :-(
I have found and fixed a bunch of problems in the driver, sent some of
them to the list, and never had any response ...
The last one I tried is still sitting around in the resent archives
("Array.getArray ()" from 07/09)...
So, I have decided to give up, and stop wasting my time on this. When I
run into problems, I just patch the driver source locally, and use the
fixed version...
Don't see much point in sending the patches to the list anymore :-(
Dima
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 19:52 Kris Jurka <books@ejurka.com>
parent: Dmitry Tkach <dmitry@openratings.com>
0 siblings, 1 reply; 40+ messages in thread
From: Kris Jurka @ 2003-07-17 19:52 UTC (permalink / raw)
To: Dmitry Tkach <dmitry@openratings.com>; +Cc: pgsql-jdbc
On Thu, 17 Jul 2003, Dmitry Tkach wrote:
> Felipe Schnack wrote:
>
> > How are patches being applied to pgsql driver? I would like to
> implement any new feature to it... but months ago I sent a patch to
> implement the "DEFAULT" keyword, introduced in pgsql 7.3. The problem
> is that the last time I checked it still wasn't on the official
> sources... and it wasn't a long time ago. > This really made me lost
> the will to help :-( >
I was under the impression that this patch was rejected, not abandoned,
but the archives are down at the moment so I can't check that.
> Same here :-(
> I have found and fixed a bunch of problems in the driver, sent some of
> them to the list, and never had any response ...
> The last one I tried is still sitting around in the resent archives
> ("Array.getArray ()" from 07/09)...
>
> So, I have decided to give up, and stop wasting my time on this. When I
> run into problems, I just patch the driver source locally, and use the
> fixed version...
> Don't see much point in sending the patches to the list anymore :-(
>
Please continue sending them. Dave and Barry, the two maintainers, may
not be the fastest at getting patches in, but they do notice patches and
then get to them when they can. I've rarely seen a patch dropped,
although the delay can be significant.
Even if the patch is not applied the beauty of open source allows other
users to apply it locally as well.
Kris Jurka
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 19:55 Felipe Schnack <felipes@ritterdosreis.br>
parent: Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 40+ messages in thread
From: Felipe Schnack @ 2003-07-17 19:55 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; pgsql-jdbc
> > > How are patches being applied to pgsql driver? I would like to
> > implement any new feature to it... but months ago I sent a patch to
> > implement the "DEFAULT" keyword, introduced in pgsql 7.3. The problem
> > is that the last time I checked it still wasn't on the official
> > sources... and it wasn't a long time ago. > This really made me lost
> > the will to help :-( >
>
> I was under the impression that this patch was rejected, not abandoned,
> but the archives are down at the moment so I can't check that.
Nobody told me anything so I could fix them anyway.
> Even if the patch is not applied the beauty of open source allows
> other users to apply it locally as well.
Well, I have seen other patches being applied... so I hope mine was rejected actually, but I never knew that.
--
/~\ The ASCII Felipe Schnack (felipes@ritterdosreis.br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893
Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 21:11 Dave Cramer <davec@fastcrypt.com>
parent: Dmitry Tkach <dmitry@openratings.com>
2 siblings, 0 replies; 40+ messages in thread
From: Dave Cramer @ 2003-07-17 21:11 UTC (permalink / raw)
To: Dmitry Tkach <dmitry@openratings.com>; +Cc: Felipe Schnack <felipes@ritterdosreis.br>; Rich Cullingford <rculling@sysd.com>; pgsql-jdbc
This isn't true any more, the backend supports with hold now, so you can
declare a cursor outside a transaction
Dave
On Thu, 2003-07-17 at 13:25, Dmitry Tkach wrote:
> Felipe Schnack wrote:
>
> > but I said I can't understand it when autocommit is off, not when it's on...
> >
> autocommit is off == you are in transaction.
>
> You must be in transaction to be able to declare a cursor.
>
> Dima
>
> >
> >On Thu, 17 Jul 2003 13:16:15 -0400
> >Dmitry Tkach <dmitry@openratings.com> wrote:
> >
> >
> >
> >>Felipe Schnack wrote:
> >>
> >>
> >>
> >>> Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
> >>>
> >>>
> >>>
> >>>
> >>Because you can only have cursors declared inside a transaction :-(
> >>
> >>Dima
> >>
> >>
> >>
> >>>On Thu, 17 Jul 2003 13:01:43 -0400
> >>>Dmitry Tkach <dmitry@openratings.com> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Rich Cullingford wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>All,
> >>>>>Will this function be implemented in Release 7.4? I have several arge
> >>>>>tables that run Java out of memory when I attempt to load them through
> >>>>>JDBC. Any workarounds arppreciated...
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>I was using cursors for a while as a workaround...
> >>>>Something like this:
> >>>>
> >>>>c.setAutocommit (false);
> >>>>Statement s = c.createStatement ();
> >>>>s.execute ("declare foo cursor for select * from bar");
> >>>>
> >>>>while (true)
> >>>>{
> >>>> ResultSet rs = s.executeQuery ("fetch 10 from foo");
> >>>> int count = 0;
> >>>> while (rs.next ())
> >>>> {
> >>>> count++;
> >>>> doStuffWithThisRow (rs);
> >>>> }
> >>>>
> >>>> if (count < 10) //The whole cursor contents has been processed
> >>>> break;
> >>>>}
> >>>>
> >>>>
> >>>>I hope, it helps...
> >>>>
> >>>>Dima
> >>>>
> >>>>
> >>>>
> >>>>---------------------------(end of broadcast)---------------------------
> >>>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-17 21:12 Dave Cramer <Dave@micro-automation.net>
parent: Dmitry Tkach <dmitry@openratings.com>
2 siblings, 1 reply; 40+ messages in thread
From: Dave Cramer @ 2003-07-17 21:12 UTC (permalink / raw)
To: ; +Cc: pgsql-jdbc
This isn't true any more, the backend supports with hold now, so you can
declare a cursor outside a transaction
Dave
On Thu, 2003-07-17 at 13:25, Dmitry Tkach wrote:
> Felipe Schnack wrote:
>
> > but I said I can't understand it when autocommit is off, not when it's on...
> >
> autocommit is off == you are in transaction.
>
> You must be in transaction to be able to declare a cursor.
>
> Dima
>
> >
> >On Thu, 17 Jul 2003 13:16:15 -0400
> >Dmitry Tkach <dmitry@openratings.com> wrote:
> >
> >
> >
> >>Felipe Schnack wrote:
> >>
> >>
> >>
> >>> Seems to me like a quite good solution! But why this is needed when autocommit is off? I can't understand.
> >>>
> >>>
> >>>
> >>>
> >>Because you can only have cursors declared inside a transaction :-(
> >>
> >>Dima
> >>
> >>
> >>
> >>>On Thu, 17 Jul 2003 13:01:43 -0400
> >>>Dmitry Tkach <dmitry@openratings.com> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Rich Cullingford wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>All,
> >>>>>Will this function be implemented in Release 7.4? I have several arge
> >>>>>tables that run Java out of memory when I attempt to load them through
> >>>>>JDBC. Any workarounds arppreciated...
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>I was using cursors for a while as a workaround...
> >>>>Something like this:
> >>>>
> >>>>c.setAutocommit (false);
> >>>>Statement s = c.createStatement ();
> >>>>s.execute ("declare foo cursor for select * from bar");
> >>>>
> >>>>while (true)
> >>>>{
> >>>> ResultSet rs = s.executeQuery ("fetch 10 from foo");
> >>>> int count = 0;
> >>>> while (rs.next ())
> >>>> {
> >>>> count++;
> >>>> doStuffWithThisRow (rs);
> >>>> }
> >>>>
> >>>> if (count < 10) //The whole cursor contents has been processed
> >>>> break;
> >>>>}
> >>>>
> >>>>
> >>>>I hope, it helps...
> >>>>
> >>>>Dima
> >>>>
> >>>>
> >>>>
> >>>>---------------------------(end of broadcast)---------------------------
> >>>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
--
Dave Cramer <Dave@micro-automation.net>
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-18 02:54 Tom Lane <tgl@sss.pgh.pa.us>
parent: Dave Cramer <Dave@micro-automation.net>
0 siblings, 2 replies; 40+ messages in thread
From: Tom Lane @ 2003-07-18 02:54 UTC (permalink / raw)
To: Dave@micro-automation.net; +Cc: pgsql-jdbc
Dave Cramer <Dave@micro-automation.net> writes:
> This isn't true any more, the backend supports with hold now, so you can
> declare a cursor outside a transaction
However, if the problem is that the query result is too large to hold in
memory, then a WITH HOLD cursor is a terrible solution. You are simply
moving the problem of coping with the fully-materialized query result
out of the client and into the backend. Admittedly the backend is
probably better able to cope than the client (at least it knows how to
spill rows to disk...), but if you are trying to get good performance
on huge result sets you do not want to use a held cursor, any more than
you want to suck the whole result into client memory.
regards, tom lane
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-18 12:37 Dave Cramer <Dave@micro-automation.net>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 40+ messages in thread
From: Dave Cramer @ 2003-07-18 12:37 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc
I stand corrected.
Dave
On Thu, 2003-07-17 at 22:54, Tom Lane wrote:
> Dave Cramer <Dave@micro-automation.net> writes:
> > This isn't true any more, the backend supports with hold now, so you can
> > declare a cursor outside a transaction
>
> However, if the problem is that the query result is too large to hold in
> memory, then a WITH HOLD cursor is a terrible solution. You are simply
> moving the problem of coping with the fully-materialized query result
> out of the client and into the backend. Admittedly the backend is
> probably better able to cope than the client (at least it knows how to
> spill rows to disk...), but if you are trying to get good performance
> on huge result sets you do not want to use a held cursor, any more than
> you want to suck the whole result into client memory.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
--
Dave Cramer <Dave@micro-automation.net>
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize()
@ 2003-07-18 15:21 Dmitry Tkach <dmitry@openratings.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 40+ messages in thread
From: Dmitry Tkach @ 2003-07-18 15:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc; bechtel@ipcon.de
Tom Lane wrote:
>Dave Cramer <Dave@micro-automation.net> writes:
>
>
>>This isn't true any more, the backend supports with hold now, so you can
>>declare a cursor outside a transaction
>>
>>
>
>However, if the problem is that the query result is too large to hold in
>memory, then a WITH HOLD cursor is a terrible solution. You are simply
>moving the problem of coping with the fully-materialized query result
>out of the client and into the backend. Admittedly the backend is
>probably better able to cope than the client (at least it knows how to
>spill rows to disk...), but if you are trying to get good performance
>on huge result sets you do not want to use a held cursor, any more than
>you want to suck the whole result into client memory.
>
>
Aha! That seems to explain those memory problems the other guy (Patric,
I think) was complaining about earlier...
Dima
^ permalink raw reply [nested|flat] 40+ messages in thread
* setFetchSize
@ 2004-01-06 12:26 Karlmeier, Volker <Volker.Karlmeier@easy.de>
0 siblings, 1 reply; 40+ messages in thread
From: Karlmeier, Volker @ 2004-01-06 12:26 UTC (permalink / raw)
To: pgsql-jdbc
Hi there,
we've go a Problem with the postgres jdbc driver:
we need to set a fetch size (setFetchSize) to get fast results from
database queries. Unfortunately, setFetchSize is not supported by
the pg73jdbc3.jar.
As I've read in the developer documentation for the 7.5 driver, this one will
support cursors and setFetchSize().
Is it possible for you to send me an alpha or beta version of this driver
for testing with out software ?
Would be quite helpful :)
Mit freundlichen Grüßen / with kind regards
EASY SOFTWARE AG <http://www.easy.de/;
Volker Karlmeier
- Entwicklung -
Am Hauptbahnhof 4
D-45468 Mülheim an der Ruhr
Fon: +49 (0208) 45016-0
Fax: +49 (0208) 45016-90
<mailto:Volker.Karlmeier@easy.de>
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2004-01-11 21:02 Kris Jurka <books@ejurka.com>
parent: Karlmeier, Volker <Volker.Karlmeier@easy.de>
0 siblings, 0 replies; 40+ messages in thread
From: Kris Jurka @ 2004-01-11 21:02 UTC (permalink / raw)
To: Karlmeier, Volker <Volker.Karlmeier@easy.de>; +Cc: pgsql-jdbc
On Tue, 6 Jan 2004, Karlmeier, Volker wrote:
> Hi there,
>
> we've go a Problem with the postgres jdbc driver:
>
> we need to set a fetch size (setFetchSize) to get fast results from
> database queries. Unfortunately, setFetchSize is not supported by
> the pg73jdbc3.jar.
> As I've read in the developer documentation for the 7.5 driver, this one will
> support cursors and setFetchSize().
This was implemented for the 7.4 driver which can be downloaded from
http://jdbc.postgresql.org/download.html
Kris Jurka
^ permalink raw reply [nested|flat] 40+ messages in thread
* setFetchSize
@ 2011-10-25 06:45 fschmidt <fschmidt@gmail.com>
0 siblings, 1 reply; 40+ messages in thread
From: fschmidt @ 2011-10-25 06:45 UTC (permalink / raw)
To: pgsql-jdbc
Usage of setFetchSize() is described here:
http://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
These restrictions make it difficult to use. Many applications (including
mine) use one connection for many tasks within a thread. So even after
turning autocommit off, there is still a chance what while I am reading my
result set, the same connection will be used somewhere else and commit()
will be called which will break the result set.
Clearly the ideal is to allow setFetchSize() to work across commits. I
don't understand why this is a problem. Postgres allows one to declare
cursors WITH HOLD to work across transactions. Why can't the JDBC driver
use this?
--
View this message in context: http://postgresql.1045698.n5.nabble.com/setFetchSize-tp4935215p4935215.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-25 07:57 Oliver Jowett <oliver@opencloud.com>
parent: fschmidt <fschmidt@gmail.com>
0 siblings, 1 reply; 40+ messages in thread
From: Oliver Jowett @ 2011-10-25 07:57 UTC (permalink / raw)
To: fschmidt <fschmidt@gmail.com>; +Cc: pgsql-jdbc
On 25 October 2011 19:45, fschmidt <fschmidt@gmail.com> wrote:
> Clearly the ideal is to allow setFetchSize() to work across commits. I
> don't understand why this is a problem. Postgres allows one to declare
> cursors WITH HOLD to work across transactions. Why can't the JDBC driver
> use this?
Because the driver's not using a SQL-level cursor, it is using a
protocol-level portal which can't be declared WITH HOLD.
Oliver
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-25 20:07 fschmidt <fschmidt@gmail.com>
parent: Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 40+ messages in thread
From: fschmidt @ 2011-10-25 20:07 UTC (permalink / raw)
To: pgsql-jdbc
Oliver Jowett wrote:
>
> Because the driver's not using a SQL-level cursor, it is using a
> protocol-level portal which can't be declared WITH HOLD.
>
Where is the documentation for portals?
--
View this message in context: http://postgresql.1045698.n5.nabble.com/setFetchSize-tp4935215p4937529.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-25 20:40 Tom Lane <tgl@sss.pgh.pa.us>
parent: fschmidt <fschmidt@gmail.com>
0 siblings, 1 reply; 40+ messages in thread
From: Tom Lane @ 2011-10-25 20:40 UTC (permalink / raw)
To: fschmidt <fschmidt@gmail.com>; +Cc: pgsql-jdbc
fschmidt <fschmidt@gmail.com> writes:
> Oliver Jowett wrote:
>> Because the driver's not using a SQL-level cursor, it is using a
>> protocol-level portal which can't be declared WITH HOLD.
> Where is the documentation for portals?
http://developer.postgresql.org/pgdocs/postgres/protocol.html
regards, tom lane
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 06:09 fschmidt <fschmidt@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 3 replies; 40+ messages in thread
From: fschmidt @ 2011-10-26 06:09 UTC (permalink / raw)
To: pgsql-jdbc
Okay I see the documentation saying portals die at the end of a transaction,
here:
http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY
But looking at the JDBC code, the main use I see of portals is for
setFetchSize(). And setFetchSize() is badly crippled in its current
implementation. Is there any fundamental reason that portals can't be made
to survive commits, like cursors WITH HOLD? This would result in a
reasonable implementation of setFetchSize().
For now I have given up on setFetchSize() as useless for my application, and
I use "select ... order by something-unique limit fetch-size offset
how-much-has-been-read". This is a bad hack. I would much rather use a
functional implementation of setFetchSize(). Is there any chance I will get
one?
--
View this message in context: http://postgresql.1045698.n5.nabble.com/setFetchSize-tp4935215p4938781.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 06:31 Oliver Jowett <oliver@opencloud.com>
parent: fschmidt <fschmidt@gmail.com>
2 siblings, 0 replies; 40+ messages in thread
From: Oliver Jowett @ 2011-10-26 06:31 UTC (permalink / raw)
To: fschmidt <fschmidt@gmail.com>; +Cc: pgsql-jdbc
On 26 October 2011 19:09, fschmidt <fschmidt@gmail.com> wrote:
> But looking at the JDBC code, the main use I see of portals is for
> setFetchSize(). And setFetchSize() is badly crippled in its current
> implementation. Is there any fundamental reason that portals can't be made
> to survive commits, like cursors WITH HOLD? This would result in a
> reasonable implementation of setFetchSize().
That would be nice to have, yes. But it would require a protocol
change which is quite a big thing to do.
Oliver
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 06:37 John R Pierce <pierce@hogranch.com>
parent: fschmidt <fschmidt@gmail.com>
2 siblings, 1 reply; 40+ messages in thread
From: John R Pierce @ 2011-10-26 06:37 UTC (permalink / raw)
To: pgsql-jdbc
On 10/25/11 11:09 PM, fschmidt wrote:
> Okay I see the documentation saying portals die at the end of a transaction,
> here:
I'm surprised you can make /any/ other queries on that connection with
an unfinished portal.
I'm pretty sure if I needed to have an open transfer while executing
another transaction, I'd use more than one connection.
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 06:45 Oliver Jowett <oliver@opencloud.com>
parent: John R Pierce <pierce@hogranch.com>
0 siblings, 0 replies; 40+ messages in thread
From: Oliver Jowett @ 2011-10-26 06:45 UTC (permalink / raw)
To: John R Pierce <pierce@hogranch.com>; +Cc: pgsql-jdbc
On 26 October 2011 19:37, John R Pierce <pierce@hogranch.com> wrote:
> On 10/25/11 11:09 PM, fschmidt wrote:
>>
>> Okay I see the documentation saying portals die at the end of a
>> transaction,
>> here:
>
> I'm surprised you can make /any/ other queries on that connection with an
> unfinished portal.
>
> I'm pretty sure if I needed to have an open transfer while executing another
> transaction, I'd use more than one connection.
You probably want to reread the protocol docs. Portals are very
similar to SQL cursors and while the portal does indeed monopolize the
connection while it is executing, you don't have to fetch all the
results from a portal in one go.
Oliver
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 08:28 Dave Cramer <pg@fastcrypt.com>
parent: fschmidt <fschmidt@gmail.com>
2 siblings, 1 reply; 40+ messages in thread
From: Dave Cramer @ 2011-10-26 08:28 UTC (permalink / raw)
To: fschmidt <fschmidt@gmail.com>; +Cc: pgsql-jdbc
On Wed, Oct 26, 2011 at 2:09 AM, fschmidt <fschmidt@gmail.com> wrote:
> Okay I see the documentation saying portals die at the end of a transaction,
> here:
>
> http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY
>
> But looking at the JDBC code, the main use I see of portals is for
> setFetchSize(). And setFetchSize() is badly crippled in its current
> implementation. Is there any fundamental reason that portals can't be made
> to survive commits, like cursors WITH HOLD? This would result in a
> reasonable implementation of setFetchSize().
>
> For now I have given up on setFetchSize() as useless for my application, and
> I use "select ... order by something-unique limit fetch-size offset
> how-much-has-been-read". This is a bad hack. I would much rather use a
> functional implementation of setFetchSize(). Is there any chance I will get
> one?
>
There is little hope that you will get what you want. I'm not even
sure I think it's a good idea as cursor with hold consumes resources
on the server which multiplied by an unknown number of connections
might end up being significant.
FWIW the JDBC docs do not imply any contract for setFetchSize.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 15:48 fschmidt <fschmidt@gmail.com>
parent: Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 40+ messages in thread
From: fschmidt @ 2011-10-26 15:48 UTC (permalink / raw)
To: pgsql-jdbc
Dave Cramer-8 wrote:
>
> There is little hope that you will get what you want. I'm not even
> sure I think it's a good idea as cursor with hold consumes resources
> on the server which multiplied by an unknown number of connections
> might end up being significant.
>
And how is it any better to force users to open a new connection to use
setFetchSize? This would use just as much resources if not more, right? It
is just much more inconvenient for programmers, especially in applications
like mine that are designed to use one connection per thread.
If there is little hope of getting what I want with Postgres, then I will
eventually have to look for an alternative database.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/setFetchSize-tp4935215p4940158.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 19:18 Dave Cramer <pg@fastcrypt.com>
parent: fschmidt <fschmidt@gmail.com>
0 siblings, 1 reply; 40+ messages in thread
From: Dave Cramer @ 2011-10-26 19:18 UTC (permalink / raw)
To: fschmidt <fschmidt@gmail.com>; +Cc: pgsql-jdbc
On Wed, Oct 26, 2011 at 11:48 AM, fschmidt <fschmidt@gmail.com> wrote:
>
> Dave Cramer-8 wrote:
>>
>> There is little hope that you will get what you want. I'm not even
>> sure I think it's a good idea as cursor with hold consumes resources
>> on the server which multiplied by an unknown number of connections
>> might end up being significant.
>>
> And how is it any better to force users to open a new connection to use
> setFetchSize? This would use just as much resources if not more, right? It
> is just much more inconvenient for programmers, especially in applications
> like mine that are designed to use one connection per thread.
My understanding is this: Postgresql is an MVCC database and can
easily provide you with a snapshot of a resultset inside a
transaction. Outside a transaction my bet is that the data has to be
copied to a temporary location somewhere, so if this is done over N
connections the resources required could be substantial.
>
> If there is little hope of getting what I want with Postgres, then I will
> eventually have to look for an alternative database.
Well every database I know of has it's idiosyncrasies, an as I said
the JDBC spec makes no guarantees of what setFetchSize should do if
anything.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 20:22 fschmidt <fschmidt@gmail.com>
parent: Dave Cramer <pg@fastcrypt.com>
0 siblings, 2 replies; 40+ messages in thread
From: fschmidt @ 2011-10-26 20:22 UTC (permalink / raw)
To: pgsql-jdbc
Dave Cramer-8 wrote:
>
> My understanding is this: Postgresql is an MVCC database and can
> easily provide you with a snapshot of a resultset inside a
> transaction. Outside a transaction my bet is that the data has to be
> copied to a temporary location somewhere, so if this is done over N
> connections the resources required could be substantial.
>
The solution is very simple. Just keep the version associated with the
current resultset around until the resultset is closed. This is basically
the same as having another connection, but in this case, each resultset on
the connection should use the version that was associated with the
connection when the resultset was opened.
> Well every database I know of has it's idiosyncrasies, an as I said
> the JDBC spec makes no guarantees of what setFetchSize should do if
> anything.
>
The JDBC spec also makes no guarantees that the database shouldn't crash.
The purpose of a spec isn't to limit what is provided to users, rather it is
to provide the minimum functionality that users can assume across
implementations.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/setFetchSize-tp4935215p4941054.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 22:37 John R Pierce <pierce@hogranch.com>
parent: fschmidt <fschmidt@gmail.com>
1 sibling, 1 reply; 40+ messages in thread
From: John R Pierce @ 2011-10-26 22:37 UTC (permalink / raw)
To: pgsql-jdbc
On 10/26/11 1:22 PM, fschmidt wrote:
> Dave Cramer-8 wrote:
>> >
>> > My understanding is this: Postgresql is an MVCC database and can
>> > easily provide you with a snapshot of a resultset inside a
>> > transaction. Outside a transaction my bet is that the data has to be
>> > copied to a temporary location somewhere, so if this is done over N
>> > connections the resources required could be substantial.
>> >
> The solution is very simple. Just keep the version associated with the
> current resultset around until the resultset is closed. This is basically
> the same as having another connection, but in this case, each resultset on
> the connection should use the version that was associated with the
> connection when the resultset was opened.
so now vacuum needs to pay attention to the oldest pending result set as
well as the oldest transaction?
hmmm.
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 22:56 Oliver Jowett <oliver@opencloud.com>
parent: fschmidt <fschmidt@gmail.com>
1 sibling, 0 replies; 40+ messages in thread
From: Oliver Jowett @ 2011-10-26 22:56 UTC (permalink / raw)
To: fschmidt <fschmidt@gmail.com>; +Cc: pgsql-jdbc
On 27 October 2011 09:22, fschmidt <fschmidt@gmail.com> wrote:
>
> Dave Cramer-8 wrote:
>>
>> My understanding is this: Postgresql is an MVCC database and can
>> easily provide you with a snapshot of a resultset inside a
>> transaction. Outside a transaction my bet is that the data has to be
>> copied to a temporary location somewhere, so if this is done over N
>> connections the resources required could be substantial.
>>
> The solution is very simple. Just keep the version associated with the
> current resultset around until the resultset is closed. This is basically
> the same as having another connection, but in this case, each resultset on
> the connection should use the version that was associated with the
> connection when the resultset was opened.
All this has already been solved, since WITH HOLD is supported for
cursors. (I think the actual implementation there copies out to
temporary storage, so perhaps the MVCC approach you suggest is not so
straightforward). Anyway, the missing part is a similar sort of
support for portals at the protocol level - I suggest you aim your
efforts at getting that supported on the server side, since the driver
can't do anything until that is supported.
>> Well every database I know of has it's idiosyncrasies, an as I said
>> the JDBC spec makes no guarantees of what setFetchSize should do if
>> anything.
>>
> The JDBC spec also makes no guarantees that the database shouldn't crash.
> The purpose of a spec isn't to limit what is provided to users, rather it is
> to provide the minimum functionality that users can assume across
> implementations.
I think Dave's point here is that the docs for setFetchSize()
explicitly says that it's a hint to the driver and the driver is free
to ignore it, so a portable application shouldn't be relying on
particular behavior.
Oliver
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 23:18 Tom Lane <tgl@sss.pgh.pa.us>
parent: John R Pierce <pierce@hogranch.com>
0 siblings, 1 reply; 40+ messages in thread
From: Tom Lane @ 2011-10-26 23:18 UTC (permalink / raw)
To: John R Pierce <pierce@hogranch.com>; +Cc: pgsql-jdbc
John R Pierce <pierce@hogranch.com> writes:
> On 10/26/11 1:22 PM, fschmidt wrote:
>> Dave Cramer-8 wrote:
>>> My understanding is this: Postgresql is an MVCC database and can
>>> easily provide you with a snapshot of a resultset inside a
>>> transaction. Outside a transaction my bet is that the data has to be
>>> copied to a temporary location somewhere, so if this is done over N
>>> connections the resources required could be substantial.
>> The solution is very simple. Just keep the version associated with the
>> current resultset around until the resultset is closed. This is basically
>> the same as having another connection, but in this case, each resultset on
>> the connection should use the version that was associated with the
>> connection when the resultset was opened.
> so now vacuum needs to pay attention to the oldest pending result set as
> well as the oldest transaction?
It's worse than that. If you have say "SELECT * FROM foo" as a
resultset, then to persist that resultset without making a copy of the
data, you not only need to keep vacuum from reclaiming the tuples
involved --- you also have to keep table foo from being dropped or
materially altered in structure. So it's not just a snapshot that has
to be hung onto, it's locks; and at that point the resultset is really
no more nor less than an open transaction. It's as complicated as one
and it has the same negative side-effects on concurrent operations as one.
We quite intentionally decided to implement held cursors by copying the
data to local storage, so that they would not need to hold onto any
shared resources after the originating transaction ends. We're not
likely to consider imposing that sort of overhead on protocol-level
portals --- they're meant to be lightweight objects.
Bottom line from a server-side point of view is that if you want that
overhead, you can ask for it, by opening a held cursor. It might be
sensible for JDBC to provide that functionality with something that
looks as much as possible like an ordinary resultset --- but I'm pretty
certain it shouldn't be the default behavior on the JDBC side either.
regards, tom lane
^ permalink raw reply [nested|flat] 40+ messages in thread
* Re: setFetchSize
@ 2011-10-26 23:34 Oliver Jowett <oliver@opencloud.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 40+ messages in thread
From: Oliver Jowett @ 2011-10-26 23:34 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: John R Pierce <pierce@hogranch.com>; pgsql-jdbc
On 27 October 2011 12:18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Bottom line from a server-side point of view is that if you want that
> overhead, you can ask for it, by opening a held cursor. It might be
> sensible for JDBC to provide that functionality with something that
> looks as much as possible like an ordinary resultset --- but I'm pretty
> certain it shouldn't be the default behavior on the JDBC side either.
We'd only do this if HOLD_CURSORS_OVER_COMMIT (which isn't the
default) was explicitly set on the resultset.
It really would be useful to specify something equivalent to WITH HOLD
on a portal though - trying to work out how to transform an arbitrary
query into a DECLARE CURSOR is the sort of SQL mangling the driver
tries to avoid doing. (It did exactly that back in the 7.3 / protocol
version 2 days and there were all sorts of nasty edge cases)
Oliver
^ permalink raw reply [nested|flat] 40+ messages in thread
end of thread, other threads:[~2011-10-26 23:34 UTC | newest]
Thread overview: 40+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-28 08:33 setFetchSize Daniel Stern <daniel.stern@teconomic.ch>
2002-10-01 16:43 setFetchSize snpe <snpe@snpe.co.yu>
2003-07-17 13:24 setFetchSize Felipe Schnack <felipes@ritterdosreis.br>
2003-07-17 13:31 ` Fernando Nasser <fnasser@redhat.com>
2003-07-17 15:38 ` Paul Thomas <paul@tmsl.demon.co.uk>
2003-07-17 16:46 setFetchSize() Rich Cullingford <rculling@sysd.com>
2003-07-17 17:01 ` Re: setFetchSize() Dmitry Tkach <dmitry@openratings.com>
2003-07-17 17:01 ` Re: setFetchSize() Felipe Schnack <felipes@ritterdosreis.br>
2003-07-17 17:16 ` Re: setFetchSize() Dmitry Tkach <dmitry@openratings.com>
2003-07-17 17:19 ` Re: setFetchSize() Felipe Schnack <felipes@ritterdosreis.br>
2003-07-17 17:25 ` Re: setFetchSize() Dmitry Tkach <dmitry@openratings.com>
2003-07-17 17:31 ` Re: setFetchSize() Felipe Schnack <felipes@ritterdosreis.br>
2003-07-17 17:41 ` Re: setFetchSize() Dmitry Tkach <dmitry@openratings.com>
2003-07-17 21:11 ` Re: setFetchSize() Dave Cramer <davec@fastcrypt.com>
2003-07-17 21:12 ` Re: setFetchSize() Dave Cramer <Dave@micro-automation.net>
2003-07-18 02:54 ` Re: setFetchSize() Tom Lane <tgl@sss.pgh.pa.us>
2003-07-18 12:37 ` Re: setFetchSize() Dave Cramer <Dave@micro-automation.net>
2003-07-18 15:21 ` Re: setFetchSize() Dmitry Tkach <dmitry@openratings.com>
2003-07-17 19:12 Re: setFetchSize() Dmitry Tkach <dmitry@openratings.com>
2003-07-17 19:19 Re: setFetchSize() Dmitry Tkach <dmitry@openratings.com>
2003-07-17 19:52 ` Re: setFetchSize() Kris Jurka <books@ejurka.com>
2003-07-17 19:55 ` Re: setFetchSize() Felipe Schnack <felipes@ritterdosreis.br>
2004-01-06 12:26 setFetchSize Karlmeier, Volker <Volker.Karlmeier@easy.de>
2004-01-11 21:02 ` Kris Jurka <books@ejurka.com>
2011-10-25 06:45 setFetchSize fschmidt <fschmidt@gmail.com>
2011-10-25 07:57 ` Oliver Jowett <oliver@opencloud.com>
2011-10-25 20:07 ` fschmidt <fschmidt@gmail.com>
2011-10-25 20:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-10-26 06:09 ` fschmidt <fschmidt@gmail.com>
2011-10-26 06:31 ` Oliver Jowett <oliver@opencloud.com>
2011-10-26 06:37 ` John R Pierce <pierce@hogranch.com>
2011-10-26 06:45 ` Oliver Jowett <oliver@opencloud.com>
2011-10-26 08:28 ` Dave Cramer <pg@fastcrypt.com>
2011-10-26 15:48 ` fschmidt <fschmidt@gmail.com>
2011-10-26 19:18 ` Dave Cramer <pg@fastcrypt.com>
2011-10-26 20:22 ` fschmidt <fschmidt@gmail.com>
2011-10-26 22:37 ` John R Pierce <pierce@hogranch.com>
2011-10-26 23:18 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-10-26 23:34 ` Oliver Jowett <oliver@opencloud.com>
2011-10-26 22:56 ` Oliver Jowett <oliver@opencloud.com>
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