Pseudo Random Nonsense Generator

Graph + relational databases

· note

GRAPH + RELATIONAL DATABASES

TODO: many database tech

Types of Databases

  • relational : MySQL, sqlite
  • graph : Neo4j
  • hierarchical : xml, json
  • document : MongoDB

RDBMS vs MongoDB

RDBMS MongoDB
Database Database
Table Collection
Tuple/Row Document
column Field
Table Join Embedded Documents
Primary Key Primary Key (Default key _id provided by mongodb itself)
Database Server and Client
Mysqld/Oracle mongod
mysql/sqlplus mongo

Relational Databases

relationships are made(setup) with Constraints

  • the you use Foreign Key CONSTRAINTS to represent relationships between data
    • by writing foreign keys, you give a row in some table an equal (or whatever) relationship to another row in the table (or another table)
      • e.g. if you put a value in this column over here in this table and there isn’t a corresponding value in this table over here, then it won’t work.
      • e.g. you may not be able to delete something here (in this row) because something is attached to it.
  • is rigid, limits the kinds of things you are allowed to put into the database
  • can get complex (and rigid) when representing relationships
    • relationships in the real world
      • e.g. multilevel joins are terribly slow
    • ORMs (Object Relational Mapping) is used to create complex queries
  • RDBMS are designed to answer known questions.
  • they have to be built with all known questions in mind so that they can be designed into the ORM

Graph Databases

[property] graphs

do this first - graphql + flask - https://www.youtube.com/watch?v=p7VujaALaGQ

in summary it’s just DOTS/NODES and LINES/EDGES all the way down

  • it more powerful than RDBMS specifically because the meaning is in the relationships
    • direct relationships (but that’s not hard to do with RDBMS)
    • indirect relationships (which are harder to traverse with relational databases) indirect relationships

usually slow and non-performant on RDBMS

- questions you didn't expect (when designing the database, which is almost always) - you can add more relationships as needed and still be performant

Document Databases

MongoDB

  • WIP