Re: Practical Cursors - Mailing list pgsql-general

From Micah Yoder
Subject Re: Practical Cursors
Date
Msg-id 01092500064800.02567@eclipse
Whole thread Raw
In response to Practical Cursors  ("Command Prompt, Inc." <pgsql-general@commandprompt.com>)
Responses Re: Practical Cursors
Re: Practical Cursors
Re: Practical Cursors
List 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


pgsql-general by date:

Previous
From: caldodge@fpcc.net (Calvin Dodge)
Date:
Subject: Re: Anyone get PHPGroupware running on RedHatLinux 7 ?
Next
From: "Karen Ellrick"
Date:
Subject: Re: Second byte of multibyte characters causing trouble