dbase_get_record_with_names; Very slow search!!!

dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 14:40:09 von Rahul Sitaram Johari

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 ...

#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@rahulsjohari.com
[Web] http://www.rahulsjohari.com





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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 14:59:31 von Ashley Sheridan

--=-Vb8a/cjYQz9ZLyqSLj+4
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Tue, 2009-11-24 at 08:40 -0500, Rahul S. Johari wrote:

> 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 ...
>
> > #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@rahulsjohari.com
> [Web] http://www.rahulsjohari.com
>
>
>
>
>


I would assume that any indexes created on any tables would be
referenced automatically by the dbms and wouldn't need to be explicitly
referenced from within PHP.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-Vb8a/cjYQz9ZLyqSLj+4--

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 15:15:58 von Rahul Sitaram Johari

On Nov 24, 2009, at 8:59 AM, Ashley Sheridan wrote:

> On Tue, 2009-11-24 at 08:40 -0500, Rahul S. Johari wrote:
>
>> 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 ...
>>
>> >> #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!
>>
>
> I would assume that any indexes created on any tables would be
> referenced automatically by the dbms and wouldn't need to be
> explicitly
> referenced from within PHP.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk



Makes sense; but I'm not sure if the Index is being referenced
here ... based on the extremely slow searches.

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

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





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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 15:16:21 von keyser soze

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 ...
>
> > #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@rahulsjohari.com
> [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

Re: Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 15:28:07 von Rahul Sitaram Johari

Your post definitely gives me hope. It's possible I'm doing something =20=

wrong!
I definitely have the foxpro database indexed. I use this FoxPro =20
command ...

INDEX ON PHONE TAG PHONE

I do have a .CDX file present for the Database and if I MODIFY =20
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 =20
FoxPro Database? Can you use SQL Commands via PHP on FoxPro databases =20=

(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=F3:
>> Ave,
>> I'm connecting to a foxpro database (dbase) and simply running a =20
>> search to retrieve a record. It's a very simple code.
>> The problem is, as the database is growing, the search is becoming =20=

>> ridiculously slow ... and I mean it's taking "minutes". When the =20
>> dbase had 10,000 records ... search was fast & efficient ... as if =20=

>> you were connecting to a mySQL Database. Now that the database has =20=

>> over 75,000 records and still growing ... it's taking minutes to =20
>> search.
>> The database has about 35 fields; Search is based on a phone number.
>> This is the code ...
>> >> #Open DBF
>> $db =3D dbase_open("dbase.dbf", 0);
>> #PULL UP RECORD
>> if ($db) {
>> $record_numbers =3D dbase_numrecords($db);
>> for ($i =3D 1; $i <=3D $record_numbers; $i++) {
>> $row =3D 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 =20
>> searches within FoxPro. These are .CDX files which contain the =20
>> Index. You can create an Index on, for example, PHONE field. =20
>> However I don't think there's any way in PHP to reference this =20
>> 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@rahulsjohari.com
>> [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
>
>
>
>
>
> --=20
> 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@rahulsjohari.com
[Web] http://www.rahulsjohari.com





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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 15:55:48 von keyser soze

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 ...
>>> >>> #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@rahulsjohari.com
>>> [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@rahulsjohari.com
> [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

Re: Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 16:05:16 von Rahul Sitaram Johari

I do believe that what I'm doing is scanning the foxpro dbase row by =20
row to get the match ... which is why it's returning the results very =20=

slow.

But I don't know if there's any other way to do this. Basically the =20
FoxPro DBF has 75,000 records and I have to search for the one row =20
which has the Phone number I'm looking for, and display results. If =20
there's any other way to do this ... I'll be more then happy to try.


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

> 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=F3:
>> Your post definitely gives me hope. It's possible I'm doing =20
>> something wrong!
>> I definitely have the foxpro database indexed. I use this FoxPro =20
>> command ...
>> INDEX ON PHONE TAG PHONE
>> I do have a .CDX file present for the Database and if I MODIFY =20
>> 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 =20=

>> FoxPro Database? Can you use SQL Commands via PHP on FoxPro =20
>> 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=F3:
>>>> Ave,
>>>> I'm connecting to a foxpro database (dbase) and simply running a =20=

>>>> search to retrieve a record. It's a very simple code.
>>>> The problem is, as the database is growing, the search is =20
>>>> becoming ridiculously slow ... and I mean it's taking "minutes". =20=

>>>> When the dbase had 10,000 records ... search was fast & =20
>>>> efficient ... as if you were connecting to a mySQL Database. Now =20=

>>>> that the database has over 75,000 records and still growing ... =20
>>>> it's taking minutes to search.
>>>> The database has about 35 fields; Search is based on a phone =20
>>>> number.
>>>> This is the code ...
>>>> >>>> #Open DBF
>>>> $db =3D dbase_open("dbase.dbf", 0);
>>>> #PULL UP RECORD
>>>> if ($db) {
>>>> $record_numbers =3D dbase_numrecords($db);
>>>> for ($i =3D 1; $i <=3D $record_numbers; $i++) {
>>>> $row =3D 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 =20
>>>> searches within FoxPro. These are .CDX files which contain the =20
>>>> Index. You can create an Index on, for example, PHONE field. =20
>>>> However I don't think there's any way in PHP to reference this =20
>>>> 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@rahulsjohari.com
>>>> [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
>>>
>>>
>>>
>>>
>>>
>>> --=20
>>> 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@rahulsjohari.com
>> [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
>
>
>
>
>
> --=20
> 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@rahulsjohari.com
[Web] http://www.rahulsjohari.com





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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 16:11:02 von keyser soze

Rahul, my friend
i found this in a first search
perhaps it be helpful

http://www.yinfor.com/blog/archives/2008/01/php_connect_dbf_ file.html



Rahul S. Johari escribió:
> I do believe that what I'm doing is scanning the foxpro dbase row by row
> to get the match ... which is why it's returning the results very slow.
>
> But I don't know if there's any other way to do this. Basically the
> FoxPro DBF has 75,000 records and I have to search for the one row which
> has the Phone number I'm looking for, and display results. If there's
> any other way to do this ... I'll be more then happy to try.
>
>
> On Nov 24, 2009, at 9:55 AM, keyser soze wrote:
>
>> 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 ...
>>>>> >>>>> #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@rahulsjohari.com
>>>>> [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@rahulsjohari.com
>>> [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
>>
>>
>
> ---
> Rahul Sitaram Johari
> Founder, Internet Architects Group, Inc.
>
> [Email] sleepwalker@rahulsjohari.com
> [Web] http://www.rahulsjohari.com
>
>
>
>
>


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 12:11:02 p.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

Re: Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 17:00:02 von Rahul Sitaram Johari

Keyser,

It gets better -- I'm on a Mac OS X (Leopard)!! As far as I know, =20
there isn't a VisualFoxPro ODBC Driver for Mac OS X.



On Nov 24, 2009, at 10:11 AM, keyser soze wrote:

> Rahul, my friend
> i found this in a first search
> perhaps it be helpful
>
> http://www.yinfor.com/blog/archives/2008/01/php_connect_dbf_ file.html
>
>
>
> Rahul S. Johari escribi=F3:
>> I do believe that what I'm doing is scanning the foxpro dbase row =20
>> by row to get the match ... which is why it's returning the results =20=

>> very slow.
>> But I don't know if there's any other way to do this. Basically the =20=

>> FoxPro DBF has 75,000 records and I have to search for the one row =20=

>> which has the Phone number I'm looking for, and display results. If =20=

>> there's any other way to do this ... I'll be more then happy to try.
>> On Nov 24, 2009, at 9:55 AM, keyser soze wrote:
>>> 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=F3:
>>>> Your post definitely gives me hope. It's possible I'm doing =20
>>>> something wrong!
>>>> I definitely have the foxpro database indexed. I use this FoxPro =20=

>>>> command ...
>>>> INDEX ON PHONE TAG PHONE
>>>> I do have a .CDX file present for the Database and if I MODIFY =20
>>>> STRUCTURE and I can see the INDEX present on PHONE.
>>>> Did you check my Code? Is there any other way to pull records off =20=

>>>> a FoxPro Database? Can you use SQL Commands via PHP on FoxPro =20
>>>> 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=F3:
>>>>>> Ave,
>>>>>> I'm connecting to a foxpro database (dbase) and simply running =20=

>>>>>> a search to retrieve a record. It's a very simple code.
>>>>>> The problem is, as the database is growing, the search is =20
>>>>>> becoming ridiculously slow ... and I mean it's taking =20
>>>>>> "minutes". When the dbase had 10,000 records ... search was =20
>>>>>> fast & efficient ... as if you were connecting to a mySQL =20
>>>>>> Database. Now that the database has over 75,000 records and =20
>>>>>> still growing ... it's taking minutes to search.
>>>>>> The database has about 35 fields; Search is based on a phone =20
>>>>>> number.
>>>>>> This is the code ...
>>>>>> >>>>>> #Open DBF
>>>>>> $db =3D dbase_open("dbase.dbf", 0);
>>>>>> #PULL UP RECORD
>>>>>> if ($db) {
>>>>>> $record_numbers =3D dbase_numrecords($db);
>>>>>> for ($i =3D 1; $i <=3D $record_numbers; $i++) {
>>>>>> $row =3D 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 =20=

>>>>>> searches within FoxPro. These are .CDX files which contain the =20=

>>>>>> Index. You can create an Index on, for example, PHONE field. =20
>>>>>> However I don't think there's any way in PHP to reference this =20=

>>>>>> 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@rahulsjohari.com
>>>>>> [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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --=20
>>>>> 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@rahulsjohari.com
>>>> [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
>>>
>>>
>>>
>>>
>>>
>>> --=20
>>> 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@rahulsjohari.com
>> [Web] http://www.rahulsjohari.com
>
>
> ---
> avast! Antivirus: Outbound message clean.
> Virus Database (VPS): 091124-0, 24/11/2009
> Tested on: 24/11/2009 12:11:02 p.m.
> avast! - copyright (c) 1988-2009 ALWIL Software.
> http://www.avast.com
>
>
>
>
>
> --=20
> 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@rahulsjohari.com
[Web] http://www.rahulsjohari.com





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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 17:11:33 von keyser soze

uhh, i don't know
(time ago Fox was multi-platform unix/mac/dos)
did you found that on the web?




Rahul S. Johari escribió:
> Keyser,
>
> It gets better -- I'm on a Mac OS X (Leopard)!! As far as I know, there
> isn't a VisualFoxPro ODBC Driver for Mac OS X.
>
>
>
> On Nov 24, 2009, at 10:11 AM, keyser soze wrote:
>
>> Rahul, my friend
>> i found this in a first search
>> perhaps it be helpful
>>
>> http://www.yinfor.com/blog/archives/2008/01/php_connect_dbf_ file.html
>>
>>
>>
>> Rahul S. Johari escribió:
>>> I do believe that what I'm doing is scanning the foxpro dbase row by
>>> row to get the match ... which is why it's returning the results very
>>> slow.
>>> But I don't know if there's any other way to do this. Basically the
>>> FoxPro DBF has 75,000 records and I have to search for the one row
>>> which has the Phone number I'm looking for, and display results. If
>>> there's any other way to do this ... I'll be more then happy to try.
>>> On Nov 24, 2009, at 9:55 AM, keyser soze wrote:
>>>> 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 ...
>>>>>>> >>>>>>> #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@rahulsjohari.com
>>>>>>> [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@rahulsjohari.com
>>>>> [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
>>>>
>>>>
>>> ---
>>> Rahul Sitaram Johari
>>> Founder, Internet Architects Group, Inc.
>>> [Email] sleepwalker@rahulsjohari.com
>>> [Web] http://www.rahulsjohari.com
>>
>>
>> ---
>> avast! Antivirus: Outbound message clean.
>> Virus Database (VPS): 091124-0, 24/11/2009
>> Tested on: 24/11/2009 12:11:02 p.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@rahulsjohari.com
> [Web] http://www.rahulsjohari.com
>
>
>
>
>


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 01:11:35 p.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

Re: Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 17:17:12 von Rahul Sitaram Johari

Back in 1996 FoxPro was multi-platform. The last FoxPro version =20
released for Mac was Visual FoxPro 3.0b (1996). After that Microsoft =20
bought FoxPro and Mac Support/Development was cut off. As of now, =20
there are NO known ODBC Drivers for FoxPro for the Mac Platform.

So that aside ... back to Original Topic:

Still no solution for a faster search through the dbf via PHP.


On Nov 24, 2009, at 11:11 AM, keyser soze wrote:

> uhh, i don't know
> (time ago Fox was multi-platform unix/mac/dos)
> did you found that on the web?
>
>
>
>
> Rahul S. Johari escribi=F3:
>> Keyser,
>> It gets better -- I'm on a Mac OS X (Leopard)!! As far as I know, =20
>> there isn't a VisualFoxPro ODBC Driver for Mac OS X.
>> On Nov 24, 2009, at 10:11 AM, keyser soze wrote:
>>> Rahul, my friend
>>> i found this in a first search
>>> perhaps it be helpful
>>>
>>> http://www.yinfor.com/blog/archives/2008/01/=20
>>> php_connect_dbf_file.html
>>>
>>>
>>>
>>> Rahul S. Johari escribi=F3:
>>>> I do believe that what I'm doing is scanning the foxpro dbase row =20=

>>>> by row to get the match ... which is why it's returning the =20
>>>> results very slow.
>>>> But I don't know if there's any other way to do this. Basically =20
>>>> the FoxPro DBF has 75,000 records and I have to search for the =20
>>>> one row which has the Phone number I'm looking for, and display =20
>>>> results. If there's any other way to do this ... I'll be more =20
>>>> then happy to try.
>>>> On Nov 24, 2009, at 9:55 AM, keyser soze wrote:
>>>>> 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=F3:
>>>>>> Your post definitely gives me hope. It's possible I'm doing =20
>>>>>> something wrong!
>>>>>> I definitely have the foxpro database indexed. I use this =20
>>>>>> FoxPro command ...
>>>>>> INDEX ON PHONE TAG PHONE
>>>>>> I do have a .CDX file present for the Database and if I MODIFY =20=

>>>>>> STRUCTURE and I can see the INDEX present on PHONE.
>>>>>> Did you check my Code? Is there any other way to pull records =20
>>>>>> off a FoxPro Database? Can you use SQL Commands via PHP on =20
>>>>>> 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=F3:
>>>>>>>> Ave,
>>>>>>>> I'm connecting to a foxpro database (dbase) and simply =20
>>>>>>>> running a search to retrieve a record. It's a very simple code.
>>>>>>>> The problem is, as the database is growing, the search is =20
>>>>>>>> becoming ridiculously slow ... and I mean it's taking =20
>>>>>>>> "minutes". When the dbase had 10,000 records ... search was =20
>>>>>>>> fast & efficient ... as if you were connecting to a mySQL =20
>>>>>>>> Database. Now that the database has over 75,000 records and =20
>>>>>>>> still growing ... it's taking minutes to search.
>>>>>>>> The database has about 35 fields; Search is based on a phone =20=

>>>>>>>> number.
>>>>>>>> This is the code ...
>>>>>>>> >>>>>>>> #Open DBF
>>>>>>>> $db =3D dbase_open("dbase.dbf", 0);
>>>>>>>> #PULL UP RECORD
>>>>>>>> if ($db) {
>>>>>>>> $record_numbers =3D dbase_numrecords($db);
>>>>>>>> for ($i =3D 1; $i <=3D $record_numbers; $i++) {
>>>>>>>> $row =3D 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 =20
>>>>>>>> for searches within FoxPro. These are .CDX files which =20
>>>>>>>> contain the Index. You can create an Index on, for example, =20
>>>>>>>> PHONE field. However I don't think there's any way in PHP to =20=

>>>>>>>> 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@rahulsjohari.com
>>>>>>>> [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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --=20
>>>>>>> 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@rahulsjohari.com
>>>>>> [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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --=20
>>>>> 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@rahulsjohari.com
>>>> [Web] http://www.rahulsjohari.com
>>>
>>>
>>> ---
>>> avast! Antivirus: Outbound message clean.
>>> Virus Database (VPS): 091124-0, 24/11/2009
>>> Tested on: 24/11/2009 12:11:02 p.m.
>>> avast! - copyright (c) 1988-2009 ALWIL Software.
>>> http://www.avast.com
>>>
>>>
>>>
>>>
>>>
>>> --=20
>>> 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@rahulsjohari.com
>> [Web] http://www.rahulsjohari.com
>
>
> ---
> avast! Antivirus: Outbound message clean.
> Virus Database (VPS): 091124-0, 24/11/2009
> Tested on: 24/11/2009 01:11:35 p.m.
> avast! - copyright (c) 1988-2009 ALWIL Software.
> http://www.avast.com
>
>
>
>
>
> --=20
> 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@rahulsjohari.com
[Web] http://www.rahulsjohari.com





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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 18:22:25 von olavell

Ashley Sheridan wrote:

> I would assume that any indexes created on any tables would be
> referenced automatically by the dbms and wouldn't need to be explicitly
> referenced from within PHP.

This is dBase (.dbf) he is asking about. There is no such thing as a DBMS
in dBase. The program / driver that accesses the data must handle
everything.


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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 18:27:42 von Rahul Sitaram Johari

Quite right.

Unfortunately there doesn't seem to be any available ODBC Drivers for
FoxPro available for Mac OS X either!! I'm hitting a brick wall no
matter what direction I take.


On Nov 24, 2009, at 12:22 PM, Olav wrote:

> Ashley Sheridan wrote:
>
>> I would assume that any indexes created on any tables would be
>> referenced automatically by the dbms and wouldn't need to be
>> explicitly
>> referenced from within PHP.
>
> This is dBase (.dbf) he is asking about. There is no such thing as a
> DBMS
> in dBase. The program / driver that accesses the data must handle
> everything.
>
>
> --
> 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@rahulsjohari.com
[Web] http://www.rahulsjohari.com





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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 18:37:32 von Paul M Foster

On Tue, Nov 24, 2009 at 08:40:09AM -0500, Rahul S. Johari wrote:

> 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 ...
>
> > #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?
>

Check the PHP routines you use to access your xBase files. If none of
them mention indexes, I think you'll find that the PHP xBase drivers do
not *use* them. One problem is that dBase uses .ndx indexes, FoxPro uses
..cdx indexes, and others use .ntx files. xBase drivers are written for
the file format itself, not for the multiple kinds of indexes. Moreover,
without selecting the specific index tag, your search won't go any
faster as a result of the index.

I suspect the bottleneck is in the way the drivers access the file.
xBase is a fixed length record format with a variable length header, so
it's pretty simple and fast to pull up successive records.

I wrote a C program many years ago to access xBase files:

http://sourceforge.net/projects/dbfsak

Unfortunately, it's not possible with this program to access individual
fields by name.

Paul

--
Paul M. Foster

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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 18:46:37 von olavell

Rahul S. Johari wrote:

> Quite right.
>
> Unfortunately there doesn't seem to be any available ODBC Drivers for
> FoxPro available for Mac OS X either!! I'm hitting a brick wall no
> matter what direction I take.

Convert to SQLite and don't look back ;)

Unless your DBF files are still in use in another application of course.
If that use is not simultaneous you could at least trivially write an
import/export routine.


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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 18:59:35 von Rahul Sitaram Johari

Well I use mySQL on my Mac for all my other database work. This
particular database is natively produced in FoxPro as that is what our
Company uses. My website offers some of our clients this data (stored
in FoxPro DBF's) using PHP which is running on an Apache Web Server on
Mac OS X.

I am looking into the option of importing the DBF records in my mySQL
Server on my Mac. The one issue that's coming to my mind is ... the
DBF is updated daily. An "End-Of-Day" program run at night updates the
FoxPro DBF. I can write a program in PHP to import the DBF Records -->
mySQL ... however, I'm going to need to somehow Automate this
procedure so that it runs automatically every nigh (or early
morning) ... and also such that only NEWER records are imported from
the DBF --> mySQL.

Sounds a bit rough ... but seems to be a plausible solution.

On Nov 24, 2009, at 12:46 PM, Olav wrote:

> Rahul S. Johari wrote:
>
>> Quite right.
>>
>> Unfortunately there doesn't seem to be any available ODBC Drivers for
>> FoxPro available for Mac OS X either!! I'm hitting a brick wall no
>> matter what direction I take.
>
> Convert to SQLite and don't look back ;)
>
> Unless your DBF files are still in use in another application of
> course.
> If that use is not simultaneous you could at least trivially write an
> import/export routine.
>
>
> --
> 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@rahulsjohari.com
[Web] http://www.rahulsjohari.com





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

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 19:41:22 von Ashley Sheridan

--=-1KQO+KmR5Bx+s3deCbZN
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Tue, 2009-11-24 at 12:59 -0500, Rahul S. Johari wrote:

> Well I use mySQL on my Mac for all my other database work. This
> particular database is natively produced in FoxPro as that is what our
> Company uses. My website offers some of our clients this data (stored
> in FoxPro DBF's) using PHP which is running on an Apache Web Server on
> Mac OS X.
>
> I am looking into the option of importing the DBF records in my mySQL
> Server on my Mac. The one issue that's coming to my mind is ... the
> DBF is updated daily. An "End-Of-Day" program run at night updates the
> FoxPro DBF. I can write a program in PHP to import the DBF Records -->
> mySQL ... however, I'm going to need to somehow Automate this
> procedure so that it runs automatically every nigh (or early
> morning) ... and also such that only NEWER records are imported from
> the DBF --> mySQL.
>
> Sounds a bit rough ... but seems to be a plausible solution.
>
> On Nov 24, 2009, at 12:46 PM, Olav wrote:
>
> > Rahul S. Johari wrote:
> >
> >> Quite right.
> >>
> >> Unfortunately there doesn't seem to be any available ODBC Drivers for
> >> FoxPro available for Mac OS X either!! I'm hitting a brick wall no
> >> matter what direction I take.
> >
> > Convert to SQLite and don't look back ;)
> >
> > Unless your DBF files are still in use in another application of
> > course.
> > If that use is not simultaneous you could at least trivially write an
> > import/export routine.
> >
> >
> > --
> > 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@rahulsjohari.com
> [Web] http://www.rahulsjohari.com
>
>
>
>
>


What about triggering an update of a MySQL database at the same time and
in the same way on the same server as the FoxPro one? Then you can just
copy the directory related to that particular MySQL database when the
job has completed and you'll have a full backup.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-1KQO+KmR5Bx+s3deCbZN--

Re: dbase_get_record_with_names; Very slow search!!!

am 24.11.2009 21:54:18 von Paul M Foster

On Tue, Nov 24, 2009 at 12:59:35PM -0500, Rahul S. Johari wrote:

> Well I use mySQL on my Mac for all my other database work. This
> particular database is natively produced in FoxPro as that is what our
> Company uses. My website offers some of our clients this data (stored
> in FoxPro DBF's) using PHP which is running on an Apache Web Server on
> Mac OS X.
>
> I am looking into the option of importing the DBF records in my mySQL
> Server on my Mac. The one issue that's coming to my mind is ... the
> DBF is updated daily. An "End-Of-Day" program run at night updates the
> FoxPro DBF. I can write a program in PHP to import the DBF Records -->
> mySQL ... however, I'm going to need to somehow Automate this
> procedure so that it runs automatically every nigh (or early
> morning) ... and also such that only NEWER records are imported from
> the DBF --> mySQL.
>
> Sounds a bit rough ... but seems to be a plausible solution.

The program I mentioned earlier:

http://sourceforge.net/projects/dbfsak

is designed to dump out the contents of a DBF into a form that can be
imported into MySQL or PostgreSQL. That's part of what I use it for.
(No, I don't make any money off the program. I wrote it for my own use
and put it up on sourceforge years ago in case someone could use it.)

Paul

--
Paul M. Foster

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

RE: Re: dbase_get_record_with_names; Very slow search!!!

am 30.11.2009 17:07:30 von Bob McConnell

From: news

> 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....
>=20
> pay attention to the comment of Ashley
> in Fox, you should:
>=20
> SELECT directory
> INDEX on phone_number to idx_directory_phone
> - or -
> INDEX on phone_number tag phone of cdx_directory
>=20
> i worked with Fox
> with dbfs of 2 millions of records
> and the speed is amazing -- using indexes of course!

It has been a long time since I worked with either FoxPro or dBase, but
IIRC, both required you to explicitly create any indexes they might
need. They don't have query analyzers like Postgres, MySQL and other
modern DBMS engines.

Bob McConnell

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

Re: Re: dbase_get_record_with_names; Very slow search!!!

am 30.11.2009 17:17:01 von keyser soze

--------------070800020503020704020100
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

of course, i agree
xbase needed indexes to work properly


Bob McConnell escribió:
> From: news
>
>
>> 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!
>>
>
> It has been a long time since I worked with either FoxPro or dBase, but
> IIRC, both required you to explicitly create any indexes they might
> need. They don't have query analyzers like Postgres, MySQL and other
> modern DBMS engines.
>
> Bob McConnell
>
>



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091130-0, 30/11/2009
Tested on: 30/11/2009 01:17:03 p.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com



--------------070800020503020704020100--

Re: Re: dbase_get_record_with_names; Very slow search!!!

am 30.11.2009 17:35:11 von Rahul Sitaram Johari

On Nov 30, 2009, at 11:07 AM, Bob McConnell wrote:

> From: news
>
>> 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!
>
> It has been a long time since I worked with either FoxPro or dBase,
> but
> IIRC, both required you to explicitly create any indexes they might
> need. They don't have query analyzers like Postgres, MySQL and other
> modern DBMS engines.
>
> Bob McConnell

That is correct! But in my case - I DO indeed have Indexes created
manually. FoxPro created .CDX files for Indexes. The problem is - does
PHP use those indexes?

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

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





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

Re: Re: dbase_get_record_with_names; Very slow search!!!

am 30.11.2009 17:46:55 von Rahul Sitaram Johari

On Nov 30, 2009, at 11:41 AM, Bob McConnell wrote:

> From: Rahul S. Johari
>
>> On Nov 30, 2009, at 11:07 AM, Bob McConnell wrote:
>>
>>> From: news
>>>
>>>> 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!
>>>
>>> It has been a long time since I worked with either FoxPro or dBase,
>>> but
>>> IIRC, both required you to explicitly create any indexes they might
>>> need. They don't have query analyzers like Postgres, MySQL and other
>>> modern DBMS engines.
>>>
>>> Bob McConnell
>>
>> That is correct! But in my case - I DO indeed have Indexes created
>> manually. FoxPro created .CDX files for Indexes. The problem is -
>> does
>
>> PHP use those indexes?
>
> And the secondary question is whether you have enough memory to
> 'permanently' cache those indexes? They don't improve performance very
> much unless they are kept in local memory all the time. The only way
> to
> fix this is to move to a real DBMS engine.
>
> Bob McConnell
>


Well that might be a problem. The indexes, along with the files, are
stored on the network and they are accessed over the network, not
locally. Although to be fair; I have tried using a copy of the DBF &
it's Index File (CDX) locally and it didn't make any difference to the
search.

Either way, it all points in the same direction ... using a modern
DBMS. It's just a problem on our end because all our customer data is
in FoxPro databases and all the other applications are written for
those FoxPro databases.

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

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





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