Fork me on GitHub
#off-topic
<
2016-03-14
>
borkdude09:03:50

Happy Pi-day people

vikeri09:03:02

Another question on the SQL-theme now that I have decided to go with Postgres: I understand that I can replace one-to-many relations that in MySQL has to be done with one child table pointing to a parent table with Postgres arrays. Does anyone have thoughts on when either approach should be used?

sveri10:03:34

@vikeri: You mean you want to store table data in an array that belongs to the "parent" table? I am just asking, never heard of this feature before

vikeri10:03:55

@sveri: Imagine you have a table containing users and then each user has some pets, do you put a list of those pets in an array in the user table or do you create a separate table called pets where each pet is linked back to a user through the column user_id

sveri11:03:36

@vikeri: Hm, If I have a given set of pets I guess I would put them into a different table, especially if the pets have additional attributes like age, color, whatever. If I want to store only pet names, an array seems useful.

sveri11:03:05

Yea, I guess the attributes thing is what it comes down to.

sveri14:03:39

@vikeri: Also I would wonder how the performance characteristics are in this case. What if I search for every user having a relation to pet X. Can I put indices on the arrays?

sveri17:03:46

While talking about databases, I just found about how reddit scaled there database: http://highscalability.com/blog/2010/5/17/7-lessons-learned-while-building-reddit-to-270-million-page.html Lesson 3. Sounds interesting, almost like a key-key-value store. Anyone ever tried that?