Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pile.db Unistack object database engine #882

Open
itadapter opened this issue Jun 24, 2023 · 0 comments
Open

Pile.db Unistack object database engine #882

itadapter opened this issue Jun 24, 2023 · 0 comments
Assignees
Labels
PROJECT A project which is comprised of multiple tasks
Milestone

Comments

@itadapter
Copy link
Contributor

itadapter commented Jun 24, 2023

  • Store data documents (like Mongo)
  • No rigid schema
  • documents stored in named collections/spaces
  • Indexes per space
  • Indexes use B+tree
  • Use pile as storage engine: in-mem or MMF
  • Database is backed by pile. Can have many spaces+indexes
  • System segment, stores collection and index metadata
  • When collection dropped - record from sys is erased (instant action)
  • Data and indexes are stored as pile records
  • Each record has 2-4 byte metatag - a number in system table collection/index name
  • Vacuum process goes through all records in pile and deallocates memory for metatags which do not exist
  • Indexes: single/compound fields, conditional (only index if expression is met)
  • Documents stored using BIX/Binary
  • Object allocated with X% padding for in-place changing (table option)
  • Query: API only. Use LINQ. Use index hash-joins for multiple indexes
  • Query: handlers (stored procs) written in C#, deployed as assemblies on server (UNISTACK)
  • Query: RPC-based proc invocation with NAME(params...): object pattern ala MVC

Example:

  using var db = PileDb.Mount("/home/sky/data/test-db");
//.....
  using var richest = db["customer"]
        ["idx_dob"]
        .GetRange(DateTime(1,1,1980), DateTime(1,1,1990))
        .Where(one => one.Married)
        .Max(one => one.Income);
 Console.WriteLine("The richest married customer is ${richest.FullName} making ${richest.Income}");                                

Despite what many would expect, the use of LINQ/extensions will work much faster on the server as that is what SQL does internally, only SQL does not know how to process data using primitives like indexes and open table scans, so it has to rely on statistics, whereas a custom written query in C# will outperform any "automatic" query as it is constructed around the specific database primitives (such as specific indexes) known to developer.

@itadapter itadapter added the PROJECT A project which is comprised of multiple tasks label Jun 24, 2023
@itadapter itadapter self-assigned this Jun 24, 2023
@itadapter itadapter added this to the PILE.DB milestone Jun 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PROJECT A project which is comprised of multiple tasks
Projects
None yet
Development

No branches or pull requests

1 participant