Click to See Complete Forum and Search --> : File system


ammus
July 15th, 2008, 02:14 AM
I have a plan to start a new project in which the back end is supposed to be a File system instead of a database server. And, this file is going to contain millions of records.

Since a file has to be searched sequentially, it might take a lot of time to retrieve a specific record.
I heard that, using indexing would make the search much faster.I don't have much of an idea about how to implement indexing.

i want to know how indexing is carried out in a file system...and also i want to know whether there is only a single file or multiple files for storing the large data...

pls help meeeee

thank you

davide++
July 15th, 2008, 07:11 AM
Why did you choose to use files instead of database?
Since indexing is intensively used on databases you have to re-write what was implemented yet. And you will give up all facilities that databases can offer.

ammus
July 16th, 2008, 12:11 AM
Thanks Davide++ for ur reply....
In ur opinion which one is best ....file system or database...(in security based )??

hspc
July 16th, 2008, 02:50 AM
In ur opinion which one is best ....file system or database...(in security based )??
Databases differ in the levels of complexity security. But in general, spending some time selecting the database that most suites your needs will cost you much less than re-inventing it.

CodeMillenium
July 16th, 2008, 03:22 AM
The first requirement is that each record have a specific key field on which to
match when searching. You then create an index file which holds the keys
for each record in the data file, together with the position in the data file to
which you can seek to retrieve a record. If the index file is maintained in
sorted order, searching for a record may be optimized. i.e. - If reading the
indexes sequentially, you can tell if a record doesn't exist as soon as an
index of greater value is encountered without getting a match. Also, a sorted
index can be searched using a binary search method to reduce key comparisons
to a minimum. If the index file is not maintained in sorted order on disc, it can
be read entirely into memory and sorted there before using.

Beyond a simple index, you can have a linked index which includes pointers
to the next and previous index items a la a doubly linked list. The data file itself
may also have such forward/backward pointers in each record. Such a structure
obviates the need for sorting the data, as it may be retrieved sequentially
even though the records are written randomly.

Consider and investigate ISAM - Indexed Sequential Access Method..