[comp.databases] More memory efficient index files in Foxpro - help!

tac@sei.cmu.edu (Timothy Coddington) (12/02/90)

Hello,

 I've developed an application using foxpro that involves a large database
 file(50K+ recs, 8MB).  The application basically generates reports (about
 15 types of reports).  Each report requires an index file on the main
 (large) database.  Some of the index file expressions are quite long and
 complicated.  The total space taken up by the index files is beginning to
 be a real problem, along with the time it takes to generate them.  Data is
 added to the main database on a daily basis and before any reports can be
 generated the index files have to be regenerated.  Note that I have many
 other database involved and their associated index files that have to be
 opened at the same time, so I can't keep all of the main database's index
 files active so they could be updated incrementally (just understand-let
 this be a constraint of the problem!).

 To the point: I believe that if Foxpro allowed be to create a type of
 index that didn't include all of the key information required for Seeking
 efficiently, but only established the proper order (sorted) based on the
 index expression I would save a lot of memory.

 Is there a way to generate such an index within Foxpro?

 Is it realistic to think that if I wrote a routine (C/ASM) that would
 stripout the bulky key values from an index file and redefined its
 structure, just to get at the sequencing information Foxpro would still
 provide me with the right ordering when 'skipping' thru the database?

 Is there another approach to generating such an index that isn't used for
 searching, but only for sequencing/ordering?

 Any help would be greatly appreciated - ideas, pointers, source, etc.

 I don't need some asshole telling me my problem is that I have too many
 databases, that i'm using the wrong product, or anything else that isn't
 constructive!   Please be helpful - Thanks!!!!

 Tim Coddington tac@sei.cmu.edu  (407)768-7470 w
				  (407)779-3451 h

ps is there a better way to generate reports that require database
ordering??

alexis@panix.uucp (Alexis Rosen) (12/03/90)

There are several approaches to your problem:
1) Presumably, you aren't printing the entire database on each report. So
you shoudl do the "right" thing, and not use indices at all. According to
Fox, sorting to a file and then printing the file is faster. It will also
use much less space, unless you're printing a large fraction of the total
number of records.

2) Use the For clause in the index command. This will only create entries
in the index for records which you specify.

3) Wait for FoxPro 2.0 (about 4-6 months, I think). That damn thing is so
fast that the new preferred way of dealing with this problem is to create
an index on everything and then use filters! The new indices are smaller,
as well (by about a factor of 3-6).

4) Keep databases of the records you're interested in for each report you
print. Add to them as well as the main file. Rebuild occasionally.

Methods #1 and #2 are probably best for now.

---
Alexis Rosen
Owner/Sysadmin, PANIX Public Access Unix, NY
{cmcl2,apple}!panix!alexis