maximum number of results from mysql on a page

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
muppet
Forum Newbie
Posts: 22
Joined: Sun Jan 25, 2004 2:01 pm

maximum number of results from mysql on a page

Post by muppet »

Hi,

This might sound basic and confusing - here goes, is there a maximum number of records that mysql will return to a page with out significantly slowing download time. I know it depends on the structure of the rest of the page etc.

My problem is that I have a page that potentially pulls 2500 records (id_num, county, town,postcode) from a table. This is used in a double dynamic select box. I'm having to pull this off again to populate a second series of selects - ie first select is the TO destination, second select is FROM destination. With the code I've got I don't seem to be able to use the same record set twice

Ideally i want this all one one page, I could split it across several pages but only if I have to.

Some one will no doubt look at this and say - "hes avin' a laugh"

Any help would be much appreciated.

SMIFFY :?
dave420
Forum Contributor
Posts: 106
Joined: Tue Feb 17, 2004 8:03 am

Post by dave420 »

If you're wanting to give the user a selection of 2500 records, it's gonna be slow however you do it :) Could you group them beforehand?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Show your code!

You can use the result set twice, but you need to reest the pointer back to the begining of the results using this function http://se.php.net/manual/en/function.my ... a-seek.php

Mark
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

I'm not sure but i think that you will not find a signifiant speed improvement through PHP, perhaps is better to look in a MySQL optimisation area there you will find some details like: caching some static tables etc.
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

Or instead of serving them 2500 reords on a page just give him 25 and make a browse menu for the rest, in this way you will bring from database only 25 results on every select and you will have loaded only 2 variables, so 25 +2 is an improvement :D
choppsta
Forum Contributor
Posts: 114
Joined: Thu Jul 03, 2003 11:11 am

Post by choppsta »

It looks to me like you're pulling out towns?

If so, i'd probably first have a select box with just the counties.
Then reload the page with another select box for the towns in that selected county.

or...

Have some alphabetical links (A | B | C | D | E.. etc.) which go to pages that list all the towns starting with those letters...

OR... ;)

You have a postcode field... Get the user to enter the first two digits of the postcode and then show them a list of matching towns...
Post Reply