Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #4783

Re: Query or Array functions

From Scott Johnson <noonehome@chalupasworld.com>
Newsgroups comp.lang.php
Subject Re: Query or Array functions
Date 2012-02-10 06:01 -0800
Organization A noiseless patient Spider
Message-ID <jh3802$k2$1@dont-email.me> (permalink)
References <jh1ra7$or4$1@dont-email.me> <jh2kcv$rtt$1@dont-email.me>

Show all headers | View raw


On 2/10/2012 12:26 AM, "Álvaro G. Vicario" wrote:
> El 10/02/2012 2:18, Scott Johnson escribió/wrote:
>> First off I am doing this on a back-end admin page.
>> I have a DB with lets say 5000 records and a dozen or more fields.
>>
>> On the page which will display these records I am planning on using
>> pagination to display so many records at once. So far so good.
>>
>> What i would like to do is provide a row above the table of records
>> where the user can enter text to filter the display on each column.
>>
>> I plan to use AJAX and filter as the user types which in itself is not a
>> problem.
>>
>> The problem I see is the numerous DB queries and I don't see querying
>> the DB each time the user types a letter as a practical approach. (I
>> could be wrong).
>>
>> What I was thinking of doing is loading the full record set into an
>> array and then filter out the array of the needed data as the user types.
>>
>> I have not done any intense array manipulations like this before and am
>> wondering if this seems like a practical approach.
>
> If you are worried about retrieving matching rows from a 5000 row DB
> table using a SQL query, I doubt that using a file to store a serialized
> 5000 element bi-dimensional array and looping though it to find matches
> will be faster; not to mention the mess of keeping data up-to-date and
> taking care of concurrent access.
>
> A 10,000,000 record table is a big table. A 5,000 record table is not.
> Just make sure that your SQL knowledge goes beyond "SELECT * FROM foo".
> I've seen too many amateurs in forums building web sites without even
> using the WHERE clause.
>
>

Yeah I was thinking that it would take more processing to use a separate 
data set, filter it, reorder it and then display a subset of that would 
be a bit cumbersome.

Thomas brought up a good idea to use a timer between key presses that 
would limit the queries to a time separation if the user types fast.

Thanks

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Query or Array functions Scott Johnson <noonehome@chalupasworld.com> - 2012-02-09 17:18 -0800
  Re: Query or Array functions Michael Fesser <netizen@gmx.de> - 2012-02-10 02:39 +0100
    Re: Query or Array functions Scott Johnson <noonehome@chalupasworld.com> - 2012-02-10 05:54 -0800
      Re: Query or Array functions Jerry Stuckle <jstucklex@attglobal.net> - 2012-02-10 09:26 -0500
  Re: Query or Array functions "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-02-10 09:26 +0100
    Re: Query or Array functions Scott Johnson <noonehome@chalupasworld.com> - 2012-02-10 06:01 -0800
    Re: Query or Array functions "Peter H. Coffin" <hellsop@ninehells.com> - 2012-02-11 11:20 -0600
  Re: Query or Array functions "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-10 11:12 +0100
  Re: Query or Array functions Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-10 02:44 -0800
    Re: Query or Array functions Scott Johnson <noonehome@chalupasworld.com> - 2012-02-10 06:01 -0800
      Re: Query or Array functions Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-10 06:11 -0800
      Re: Query or Array functions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-11 00:03 +0100
        Re: Query or Array functions Gregor Kofler <usenet@gregorkofler.com> - 2012-02-11 11:03 +0100
          Re: Query or Array functions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-11 12:06 +0100
  Re: Query or Array functions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-10 12:06 +0100
    Re: Query or Array functions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-10 12:32 +0100
    Re: Query or Array functions Scott Johnson <noonehome@chalupasworld.com> - 2012-02-10 05:43 -0800

csiph-web