Re: Long running queries and timeouts

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Chadwick Rolfs" <cmr(at)shell(dot)gis(dot)net>, <pgsql-php(at)postgresql(dot)org>
Subject: Re: Long running queries and timeouts
Date: 2002-01-22 01:30:32
Message-ID: GNELIHDDFBOCMGBFGEFOOEBPCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paulo J. Matos 2002-01-22 01:44:40 Include directory
Previous Message Ned Wolpert 2002-01-22 00:16:03 Re: [GENERAL] PostgreSQL Licence: GNU/GPL

Browse pgsql-php by date

  From Date Subject
Next Message Manuel Lemos 2002-01-22 04:02:10 Re: PHP Abstraction layers
Previous Message Brent R. Matzelle 2002-01-21 22:20:50 Re: PHP Abstraction layers