Re: Practical Cursors

From: Micah Yoder <yodermk(at)home(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Practical Cursors
Date: 2001-09-25 04:06:48
Message-ID: 01092500064800.02567@eclipse
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

(sorry to reply to a week-old message. need to keep up with this list more!)

On Monday 17 September 2001 17:04, you wrote:

> There is an obvious benefit to the use of cursors within a persistent
> environment. In other words, if my connection to the database is live, I
> can increase my query and display efficiency through the use of a cursor.
>
> However, this seems to be useless within a web based environment. If we
> have a live connection through a C++ application, we can perform a
> transaction and interact within the results.

Yep. That seems to be a disadvantage with ALL database systems & HTTP based
apps.

I once wrote a MySQL app (I know, but that's what the company used) to do a
fairly complicated search on a huge database full of domain names. The query
was time consuming (10-30 seconds) so it obviously could not be performed for
every prev/next page request.

My first approach was to have the PHP script write the entire data resultset
to a fixed-length file, which could be easily accessed for each request to
the point where the user was in the file. Only problem there was when the
result set was large, initial query time was significantly longer. And that
happened a lot.

I then wrote a daemon in C to do the work and store the results in RAM. The
PHP script connected to the daemon via a socket, and passed a request ID and
the numbers of the records it wanted. Sure, it was convoluted, but I
actually got the speed up to where I was fairly happy with it.

If there's a better solution than that, I'm not aware of it.

But like someone else mentioned, it's not quite "practical" database usage.

--
Like to travel? http://TravTalk.org
Micah Yoder Internet Development http://yoderdev.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Calvin Dodge 2001-09-25 04:33:08 Re: Anyone get PHPGroupware running on RedHatLinux 7 ?
Previous Message rjtalbo 2001-09-25 03:48:30 Re: Make failure on v. 7.1.2