Koolaidrain

DB Hacker Hour

Dec 4th, 2015
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.22 KB | None | 0 0
  1. Databases Hacker Hour Talk
  2.  
  3. - What is db
  4. - When to use db's in apps
  5. - SQL
  6. - No SQL
  7.  
  8. Start off by trying to model real world things, ask the audience for 3 things: Employees, RPG Character, Jungsoo
  9. -> Show that the object can be modeled in tables/cols/rows. Is this intuitive?
  10. -> Explain that to add another field is as simple as adding another column to the table.
  11. -> We can add arbitrarily many rows or 'entries' to the same 'schema' or set of columns
  12.  
  13. What if we have a shit ton of info on Jungsoo and his various states over a period of time?
  14. -> We can "analyze the data" to "predict the future" of Jungsoo!
  15. -> What if Jungsoo wants to remember what he wore in the past so he can burn those clothes? Every Monday? For the past decade? In which a Republican was elected President?
  16. -> All of these questions and analyses can be answered if we structure the information in an intelligent way.
  17. -> What's this called? ...Not data structures, databases!
  18.  
  19. Examples of use cases
  20. -> Jungsoo predicting what he should wear based on his past outfits
  21. -> Amazon predicting what you're going to buy next based on your past shopping sins
  22. -> Facebook predicting what ads will appeal to you based on your previous posts/likes
  23. -> There are things called 'mirrors' that serve people content in "big files" like emulator.zip. Information on these pathways are stored in a database running on a mirror server that "magically" knows what you want and where to find it.
  24.  
  25. Definitions
  26. -> A database is a piece of software that allows you to structure and persistently store whatever data you want.
  27. -> It keeps things secure and reliable and fast and optimized, so you don't worry about how to design storage for your data.
  28. -> File vs. Database: A file is a named block of data, whereas a database is an engine on top of a block of data that allows you to do the following:
  29.  
  30. Databases can handle querying tasks, so you don't have to walk over files manually.
  31. Databases can handle very complicated "queries", or structured ways to ask questions.
  32. Databases can do certain tasks VERY fast, like get outfit from date = 'yesterday'
  33. Databases can easily be connected to from any machine anywhere in the world
  34. Databases can watch for data integrity
  35. Databases can update data easily
  36. Databases are reliable
  37. Databases can handle transactions and concurrent access, so millions of people changing it at once is fine
  38. Databases + ORMs let you manipulate data in very programmer friendly way.
  39.  
  40. When you want to use DB's
  41. -> Follows from the definitions. Java program variables go away, but database makes sure they stay.
  42. -> If you're writing an app that handles user or account data or weather stuff or literally anything you should use a database. NO ONE USES FILES TO STORE DATA! IT'S STUPID! ERIC IS STUPID!
  43. -> Eric talks about his Matt Stone app. Example of sophisticated programming application who don't need no db.
  44. -> Databases are not this big scary thing - people who build them make them extremely simple to use, which is the entire point. Especially after some use, you get more familiar with it over time.
  45.  
  46. Classical SQL: MySQL, SQLite, PostgreSQL.
  47. -> Divide data up literally into tables with rows and columns, which can be searched through and combined and manipulated in every which way you can conceive to give you the information you're looking for.
  48. -> SQL is Structured Query Language. It's something like the code you write to interact with the database. On the spot.
  49. -> Examples: Single table queries, maybe one query that involves another table. Aggregate operators
  50.  
  51. Alternative NoSQL: Everything that's not SQL.
  52. -> But DB overlords! How else can we structure data except in rows and cols?
  53. -> Maybe with field sets! Talk about how MongoDB structures data as JSON/BSON. Use Jungsoo as example, RPG Char
  54. -> Advantages: Dynamic schema. Every object/document is not constrained by a set of cols like in SQL-based dbs.
  55. -> One problem is that null is close to meaningless. Dynamic schema means you don't have to commit as much, don't have to include fields. However, this is also a disadvantage because now your data isn't as structured.
  56. -> Also, SQL is super complex when it comes to putting your database on multiple servers, which is the case when you have billions of rows of information. MongoDB for example handles this in a simple, elegant manner so that you don't have to buy gigantic machines to store one database - you can split it across a set of smaller, cheaper machines.
  57. -> Banks want secure data and don't care how fast it is. So they would choose something like PostgreSQL to handle transactions. New and hip startups LIKE MONGODB want to scale quickly and efficiently, so Mongo or any noSQL would do great because it's easier to use for programmers.
  58.  
  59. Questions to ask
  60. -> When would you use one over the other?
  61. -> I want to build Facebook. What do I do? (mention security, performance, size, sharding)
  62.  
  63. Share Links
  64. -> But wait! You pieces of shit didn't actually teach me how to use a database!
  65. That takes time. Please research on your own now that you know what they are and when to use them.
  66. The important stuff is this information, and the rest can be learned through documentation (Mongodocs) and use
  67. -> Open forum for questions.
  68. -> Ask people some key things they learned.
Add Comment
Please, Sign In to add comment