[darcs-devel] Re: performance idea: a darcs db?
Mark Stosberg
mark at summersault.com
Fri Jan 28 17:10:09 PST 2005
On 2005-01-28, Juliusz Chroboczek <jch at pps.jussieu.fr> wrote:
>
> I also don't think that a relational database is a good idea. Haskell
> likes coinductive datatypes. SQL likes relations. I don't think the
> two mix well.
I can't answer that directly, but I did check to see that there some
libraries already out there to interface Haskell to Sqlite. Here's one:
http://haskelldb.sourceforge.net/api/
I was thinking about how you might quickly find which patches affect a
particular directory. That data could be stored in a table:
CREATE TABLE file_patch_map (
file_path VARCHAR(5000),
patch_hash VARCHAR(100),
);
-- Each file/patch relationship can only exist one
CREATE UNIQUE INDEX file_patch_idx ON file_patch_map(file_path,patch_hash);
Now finding the patches should be very fast:
-- Find all patches that affect files beneath ./my/dir
SELECT patch_hash
FROM file_patch_map
WHERE file_path LIKE './my/dir%';
If the Haskell API is anything like the Perl DBI, you should able to
have the result turned in a Haskell array for easy handling.
Mark
--
http://mark.stosberg.com/
More information about the darcs-devel
mailing list