Re: Long running queries and timeouts - Mailing list pgsql-php

From Christopher Kings-Lynne
Subject Re: Long running queries and timeouts
Date
Msg-id GNELIHDDFBOCMGBFGEFOOEBPCBAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: Long running queries and timeouts  (Chadwick Rolfs <cmr@shell.gis.net>)
List pgsql-php
> I can see why this doesn't make much sense.  Seeing as we have nothing to
> work with from the original post regarding just what the query is.. I'll
> try to give an example to explain.
>
> querying all the names in a phone book DB:
> select first_name, last_name from white_pages;
> --UH... this will be,,,let's say 150,000 entries (small city phone book)
>
> WELL, you could select by starting letters, and put it into an array,
> using pg_fetch_array, or pg_fetch_object.  Make multiple queries in the
> same script, and use that array (or object) to ouput to the browser...
>
> select first_name, last_name from white_pages where last_name like 'A%';
> select first_name, last_name from white_pages where last_name like 'B%';
> select first_name, last_name from white_pages where last_name like 'C%';
> select first_name, last_name from white_pages where last_name like 'D%';
> ...etc
>
> if it's still too long, try 'Aa%', 'Ab%' ... so on.  Tedious, but
> efficient.

You could always just use CURSORs.  Look up 'DECLARE' and 'MOVE' and 'FETCH'
sql commands in postgres.

Chris


pgsql-php by date:

Previous
From: "Brent R. Matzelle"
Date:
Subject: Re: PHP Abstraction layers
Next
From: Manuel Lemos
Date:
Subject: Re: PHP Abstraction layers