I have been wondering this for a while and finally have the chance to ask.  What I'm 
trying to do is select a bunch of names from one table in a postgresql database. The 
way I'd like to display them is alphabetically and indexed by the first letter.  So 
they look similar to this:

Alexandria, Mark
Angel, Chris
Boy, John

I know a couple ways to do it, but every way involves multiple queries.  What I'm 
wondering is when I issue a select statement to the database via pg_exec(), is the 
result loaded into memory then, or when each successive pg_fetch_array() is called?  I 
mean, it seems like if each pg_fetch_array were making a call to the database, that 
would be an unnecassary overhead on a list that has a lot of names.  But however, if 
the entire result set is in the webserver's memory, then I don't really have a problem 
with doing multiple loops through the data.  Hopefully I've described my problem 
adequately.  If any one can help, or has a better idea, please let me know.

Thank You.


Reply via email to