Search Postgresql Archives

Re: number of rown in a cursor.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jan 24, 2005, at 1:38 PM, Christoffer Gurell wrote:

the thing is that i want to create a gui-widget that has the possibility
to show a large amount of data over a slow connection. My idea was that
i create a cursor and create a srollbar with the number of rows in the
cursor so the user can scroll and only fetch the rows displayed from the
cursor as the user releases the scrollbar.


If i understand right then the way to do this is: create the cursor,
move to the end to get the number of rows, move to the front. get data.
am i right? or is there a better way to achieve this ? perhaps with a
local view?


Yes, you are correct -- see long discussions in the archives on count(*). There is no shortcut to determine the number of rows a query (or cursor) will have. One option might be to set some fairly high limit in your query (say 10,000) and then have your GUI include some little warning if it is reached. Perhaps have an easy way to increase it if user really wants to scroll more records. It is definitely a bit messy to deal with this in a GUI, but scrolling a million records won't be very useful anyway.

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux