GithubHelp home page GithubHelp logo

joshaber / freezer Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 4.0 1.03 MB

Database as a value.

Home Page: http://www.infoq.com/presentations/Datomic-Database-Value

License: MIT License

Objective-C 99.95% Shell 0.05%

freezer's People

Contributors

joshaber avatar mdiep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freezer's Issues

Sqlite database grows without bound

Currently the sqlite database just keeps adding things. That's less than ideal. We should have some way of trimming it.

Some things:

  • We could trim down to the most recent level attribute-value for all keys.
  • But it's tricky to know that someone's not holding on to an old database.
  • How does this interact with #3?

Move to a different backend?

Sqlite's awesome, LevelDB might be more awesome.

๐Ÿ‘

  • Faster than Sqlite
  • Snapshots are a non-persistent version of our immutable databases.
  • More thread-safety out of the box.
  • Sorted keys could allow for a bit more flexibility.

๐Ÿ‘Ž

  • Outside dependency.
  • Snapshots can't be persisted.
  • C++

Reify transactions

Transactions exist currently in the database, but we don't expose them to users. It could be useful:

  • Timestamp for changes.
  • List of changes.

Related to #3.

Implement attributes as columns on a single table?

Currently each attribute is its own table. We could instead implement each attribute as a column on one table. This could help address #5.

The downside is that we'd probably end up with a super wide table. I'm not sure how Sqlite feels about that.

SQLite VACUUM

We should run VACUUM. Probably as part of trimming.

Cache attribute information

Reads and writes require that we look up attribute information (type, cardinality, etc.). We should cache that.

We'd get this for free if we did #8.

Need any indexes?

We currently don't use any indexes. It'd probably make sense to index on key. Maybe attribute too?

More sophisticated querying?

Should Freezer provide more sophisticated querying?

  • Most query APIs are heavily stringly typed.
  • Could we use Sqlite functions to get more typing?

Move back to a single table

In light of #5, #12, #19, I think it'd make sense to move back to using a single table.

๐Ÿ‘

  • Simper, more consistent implementation.
  • Faster key-based reads.

๐Ÿ‘Ž

  • The value column will just be a blob, making it harder for us to leverage SQLite magic.
    • We could maybe mitigate that with custom functions which unpack the blob?
  • Less space-efficient, presumably.

Speed up key-based reads

Currently key-based reads require walking over each of attribute tables and checking if they have an entry for the key. This means it's gonna slow down as you add more attributes.

A couple thoughts on speeding it up:

  • Partition keys so that we can known based on the they that it could only have certain attributes.
  • Keep an index of the attributes which a key has.

Re-think terminology of key/attribute/value

From @mdiep.

I think the dissonance for me is that it feels like I'm mutating a dictionary, but the names don't convey that

I agree. It's tricky because dictionaries are key -> value, but Freezer's more like key -> (attribute, value).

Inserting is O(n) (lolcry)

Currently on both branches, inserting is O(n), n = number of objects in the previous "database." This is because they create a new list of objects for each insert. That's... less than ideal.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.