Table of contents
Table of Contents |
---|
Child pages
Child pages (Children Display) |
---|
- http://coding-geek.com/how-databases-work/
- Highly rec'd by soham
...
- Get all records from a particular collection once you're switched to a particular db
- 'db.<collection_name>.find()'
- Check if a field contains a string
- db.getCollection('collection_name').find({"Party1": {$regex : ".*similarly situated.*"}})
- Find records by non-existence of a field:
- db.mycollection.find({ "price" : { "$exists" : false } })
- Find a record by its id:
- db.collection_name.find({"_id": ObjectId("587862a88362593254464c69")})
- So you can find it by the id's string value, but you need to wrap the string with ObjectId()
- db.collection_name.find({"_id": ObjectId("587862a88362593254464c69")})
Neo4j
General
Tutorials
- Neo4j GraphAcademy
- There's a lot of stuff here
- Neo4j - The Definitive Guide to Graph Databases for RDBMS Developers
- 2015.09 - O'Reilly - Nicole White - Building Web Apps Using Flask and Neo4j
Tools
Pros and cons of graph databases
- Summary
- It seems like Neo4j is helpful for making join-heavy queries orders-of-magnitude faster.
- Links
- http://stackoverflow.com/questions/19570654/do-graph-databases-deprecate-relational-databases
- https://groups.google.com/forum/#!topic/neo4j/mts6H9Py-2I
- https://neo4j.com/developer/graph-db-vs-rdbms/
- "If you use many-to-many relationships, you have to introduce a JOIN table (or junction table) that holds foreign keys of both participating tables which further increases join operation costs. Those costly join operations are usually addressed by denormalising data to reduce the number of joins necessary."
- "This ability of pre-materializing relationships into database structures allows Neo4j to provide performances of several orders of magnitude, especially for join heavy queries, the minutes to milliseconds advantage that many users leverage."
PostgreSQL
Websites
Tutorials
- PostgreSQL Exercises (pgexercises.com)
- This looks good.
Extensions
- PostGIS
- This was one of the major reasons Krieger and Systrom went with Postgres over MySQL. (Source)
Books
- Lists
- Individual books
- PostgreSQL.org - PostgreSQL 9.6.1 Documentation ← This is basically a book.
- Beginner-level
- 2001 - Beginning Databases with PostgreSQL (4/5, only 11 reviews)
- 2005 - Beginning Databases with PostgreSQL: From Novice to Professional (5/5)
- 2002 - Practical PostgreSQL (2.5/5, 17 reviews)
- Intermediate-level
- 2001 - PostgreSQL (Linux) (3/5, 5 reviews)
- 2001 - PostgreSQL Developer's Handbook (4/5)
- 2005 - PostgreSQL (2nd Edition) (4/5, 22 reviews)
- 2010 - PostgreSQL 9.0 High Performance (4.5/5)
- 2014 - PostgreSQL: Up and Running (2nd ed) (3.5/5, 15 reviews)
- 2014 - PostgreSQL 9 High Availability Cookbook (5/5, 6 reviews)
- 2015 - PostgreSQL Server Programming - Second Edition (4.5/5, 5 reviews)
- 2015 - PostgreSQL Developer's Guide (3.5/5, 4 reviews)
- 2015 - PostgreSQL 9 Administration Cookbook (2nd ed) (4.5/5, 2 reviews)
- 2015 - PostgreSQL for Data Architects (5/5, 2 reviews)
- 2015 - Troubleshooting PostgreSQL (5/5, 4 reviews)
- 2015 - Learning PostgreSQL (4/5, 5 reviews)
Snippets
- Get the number of rows in all tables in a database.
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;