Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #4782
| From | Scott Johnson <noonehome@chalupasworld.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Query or Array functions |
| Date | 2012-02-10 05:54 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <jh37io$tp1$1@dont-email.me> (permalink) |
| References | <jh1ra7$or4$1@dont-email.me> <kjs8j71nmbef61oetgpvlmprfq5c5ta2rb@mfesser.de> |
On 2/9/2012 5:39 PM, Michael Fesser wrote: > .oO(Scott Johnson) > >> 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. > > Why AJAX? Why not do it the simple way with a "refresh" button? > >> 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. > > I don't think so. You still have to fetch the data from the DB whenever > the user changes the filter. Every AJAX request to the server is just > another HTTP request, completely independent from all others before. > > You can't store big data from one request and then just output parts of > it on every coming request (unless you store all the data in a session, > but this wouldn't make much sense here and would still cause a lot of IO > overhead). > > In other words: Every request (including the ones via AJAX) causes your > script to start from scratch again, so you have to fetch the data and > filter it over and over again anyway. Also don't forget that after the > user changes the filter options, the new data has to be transferred to > the client. When there's a lot of records, this might take some time. > > Don't expect a real-time display and ask yourself: Do you really need > AJAX stuff or wouldn't it be enough to use a good old-fashioned form > with a "refresh" button? > > Micha > Thanks Micha You bring up a great issues to the idea of accessing the data without a separate page load. The data would need to be loaded into a session to be accessible with subsequent calls to the server w/o calling an entire page load. Not sure how loading a large data set into a session would affect performance. I know 5000 records is not all the large in the big picture of large things but I like to 'try' to think ahead to larger issues. But Thomas brought up a good point of data being modified after the initial page load would not be represented any longer. So I think the separate data scheme is not a feasible solution any longer. Thanks
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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