[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-recutils] Indexing plan
From: |
Michał Masłowski |
Subject: |
Re: [bug-recutils] Indexing plan |
Date: |
Thu, 10 May 2012 13:26:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> Interesting. But the "lazy" reading of records can also be done even if
> there is not an index file: it is much more efficient to search for
> ^%rec: than to parse the whole file. So the lazy reading of records
> must not depend on having an index for the recfile.
Ok.
> Now I think it would be simpler to store all records in the index file,
> so parsing the recfile wouldn't be needed. My other idea was to store
> only the offsets in the recfile of their beginning, it would require
> e.g. supporting seeks in parsers and keeping the file open while the
> database is used.
>
> I much prefer the second option. To keep the file open must not be an
> issue.
Will think more what changes would be needed for this. Seekable parsers
would be also useful with lazy reading without indices.
> I believe queries filtered by non-primary key fields are common in SQL
> databases and indices are done for them, so they might be useful here.
> Although it shouldn't be more difficult to add it later.
>
> That makes sense, but I don't see why do we need to mark the fields for
> which indexes exist in the record descriptors. The idea is that the
> user can use recfix to create indexes for fields which are often used,
> like:
>
> $ recfix add-index -f AField
>
> In the example, AField is not required to be the key of the record. We
> can also create a "default" field for any %key defined. Is there a
> reason why we would need to mark AField in the record descriptor?
> recsel must be able to determine if there is an index I on the rset S
> for the field F in a given index file.
So "recfix build-index" would make indices only for keys, or for all
fields which have indices in the already found index file? A separate
"add-index" command would be more useful if the index file could be
incrementally changed, this might be simple for just adding new indices.
pgpXzLKR3SvFK.pgp
Description: PGP signature