Re: dbase_get_record_with_names; Very slow search!!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i will try to help you
but think i'm old in Fox but new in php
and sadly never used php+fox

so, reading your code
i see you are scanning the whole dbf file from php
Fox cant help you in this way

if there is not another option for scan a dbf
the row by row method is very slow




Rahul S. Johari escribió:
Your post definitely gives me hope. It's possible I'm doing something wrong! I definitely have the foxpro database indexed. I use this FoxPro command ...

INDEX ON PHONE TAG PHONE

I do have a .CDX file present for the Database and if I MODIFY STRUCTURE and I can see the INDEX present on PHONE.

Did you check my Code? Is there any other way to pull records off a FoxPro Database? Can you use SQL Commands via PHP on FoxPro databases (SELECT * FROM .... ) ?

Thanks



On Nov 24, 2009, at 9:16 AM, keyser soze wrote:

even though the dbf has 10K records
Fox can't spend "minutes" to found a match
by the way, its very strange
to have 35 columns in a table/dbf or whatever....

pay attention to the comment of Ashley
in Fox, you should:

SELECT directory
INDEX on phone_number to idx_directory_phone
- or -
INDEX on phone_number tag phone of cdx_directory

i worked with Fox
with dbfs of 2 millions of records
and the speed is amazing -- using indexes of course!

regards,
ks





Rahul S. Johari escribió:
Ave,
I'm connecting to a foxpro database (dbase) and simply running a search to retrieve a record. It's a very simple code. The problem is, as the database is growing, the search is becoming ridiculously slow ... and I mean it's taking "minutes". When the dbase had 10,000 records ... search was fast & efficient ... as if you were connecting to a mySQL Database. Now that the database has over 75,000 records and still growing ... it's taking minutes to search.
The database has about 35 fields; Search is based on a phone number.
This is the code ...
<?php
   #Open DBF
   $db = dbase_open("dbase.dbf", 0);
          #PULL UP RECORD
   if ($db) {
     $record_numbers = dbase_numrecords($db);
     for ($i = 1; $i <= $record_numbers; $i++) {
        $row = dbase_get_record_with_names($db, $i);
        if ($row['PHONE'] == $_POST['PHONE']) {
                      #Retrieve row & display fields
           echo $row['STUFF'];               }       }
}
?>
It works ... but it's getting way too slow.
One thing with FoxPro DBF's is that they use an Index file for searches within FoxPro. These are .CDX files which contain the Index. You can create an Index on, for example, PHONE field. However I don't think there's any way in PHP to reference this Index file for faster searches.
Is there any possibility to improve search response time?
Thanks!
---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]    sleepwalker@xxxxxxxxxxxxxxxx
[Web]    http://www.rahulsjohari.com


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:16:25 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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



---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email]    sleepwalker@xxxxxxxxxxxxxxxx
[Web]    http://www.rahulsjohari.com







---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:55:50 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux