Kondwani Spike Mkandawire wrote:

>Hallo folks:
>
>I have a bit of an issue with Paradox Table Searching...
>I have a fairly large table (4MB+), here is the problem:
>
I've not been monitoring this thread so what I say may have been 
covered, so please bear with me.

>
>When I run a search for an element in the Table on
>my localhost which is running Apache and php 4.1,
>I have no issues with speed...  However when I run it
>on the Server at my work place, which is running IIS
>Server (I am not sure which version), and the same
>PHP version on my Workstation it takes ages to execute...
>
Is the table layout, indices, amount of data and ODBC connection the 
same in both cases? How long is ages? If minutes then is it a DNS 
problem in connecting to the server computer? You could try this by 
getting an item of data from a new table containing only one row.

>I have gotten suggestions and have revised my Script
>over and over using odbc_exec() with SQL commands
>SELECT myColumn FROM myTable, I have used
>a COUNT SQL command suggested on this forum,
>My general algorithm is as follows...
>
>1)  I create an Array using odbc_fetch_array this Array
>     contains one column from the Table I am searching...
>2)  Keep trying to matchup each element in the array
>     against the validation element being checked...
>     returning found within a sequential loop...
>     and eventually "Not Found"...
>
Do I understand correctly, you have an unordered array and you are 
comparing every element with every record (also unordered) from a database?

>
>3)  I suppose the sequential loop is whats killing me,
>      but the table is not ordered hence I am forced to
>      do a sequential search..  Does anyone else have
>      an idea for a quicker and much more efficient
>      algorithm...
>
If so then I agree. I'd order the php array (either ascending or 
descending) and ask for the  database records similarly ordered (e.g. 
select myColumn from myTable order by myColumn). Then you only need make 
the comparisons until the value is lower (or higher) than the one it is 
being compared with. Make sure there is an index on myColumn in the 
database.

>
>Once again the issue of Speed is a non-factor on
>my local machine running Apache but it does become a
>factor when I run it on our Server, which is running an
>IIS Server...
>
I may not like IIS but I cannot see that it is to blame here.

HTH
Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to