Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #18416
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Php/Mysql paginate results without resubmitting query |
| Date | 2020-11-19 22:54 +0100 |
| Message-ID | <i1o7snFbhv4U1@mid.individual.net> (permalink) |
| References | <rp67bt$up2$1@gioia.aioe.org> |
On 19/11/2020 17.43, cb wrote:
> Please be patients !
> I'm doing a big (sort of) select:
> SELECT column1,column2 FROM table ORDER BY column1 LIMIT $count OFFSET
> $offset;
> (Without the LIMIT the select fails for exceeding time limit or whatelse.)
> The user is then allowed to "page down" for getting next $count rows.
> It works, BUT the query is re-submitted scanning again the whole DB.
>
> Is there a way to store the RESULTS of the original query, and then
> "paginate" into it (into the stored results) not into the DB?
You would need memcached or other cache system, you check if your data
structure is stored in the cache system, if not then you fetch the data
and process it to the format you want to use and store it to the cache.
Keep in mind that you will have an execution timeout when you try to
fetch all the data, so it wouldn't help you anything to use a cache system.
> Googling around I've found (and I'm doing it!)
> $rc = mysqli_query($db, $qlib);
> while ($row = mysqli_fetch_array($rc)) {
> array_push($righe, $row);
> }
> BUT if $qlib has no LIMIT it abend for exceeding limits.
For it's faster to work on a subset of the data than the whole data.
As Jerry already pointed out, you should look at using indexes, as it
will improve your sort speed.
--
//Aho
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Php/Mysql paginate results without resubmitting query cb <cb@ppt.io.it> - 2020-11-19 17:43 +0100
Re: Php/Mysql paginate results without resubmitting query Jerry Stuckle <jstucklex@attglobal.net> - 2020-11-19 15:05 -0500
Re: Php/Mysql paginate results without resubmitting query cb <cb@ppt.io.it> - 2020-11-21 18:03 +0100
Re: Php/Mysql paginate results without resubmitting query "J.O. Aho" <user@example.net> - 2020-11-19 22:54 +0100
Re: Php/Mysql paginate results without resubmitting query cb <cb@ppt.io.it> - 2020-11-20 08:36 +0100
Re: Php/Mysql paginate results without resubmitting query cb <cb@ppt.io.it> - 2020-11-20 08:45 +0100
Re: Php/Mysql paginate results without resubmitting query cb <cb@ppt.io.it> - 2020-11-20 08:53 +0100
Re: Php/Mysql paginate results without resubmitting query "J.O. Aho" <user@example.net> - 2020-11-20 10:15 +0100
Re: Php/Mysql paginate results without resubmitting query cb <cb@ppt.io.it> - 2020-11-20 11:30 +0100
Re: Php/Mysql paginate results without resubmitting query Jerry Stuckle <jstucklex@attglobal.net> - 2020-11-20 11:05 -0500
Re: Php/Mysql paginate results without resubmitting query Arno Welzel <usenet@arnowelzel.de> - 2020-11-20 17:42 +0100
csiph-web