IT/Software career thread: Invert binary trees for dollars.

  • Guest, some asshat always complains they didn't know the tournie was running, so here's another notice!



    Go here and vote as hard as you can!
    This year's bracket is especially girthy, thanks to Asshat Lurkingdirk, so show your size appreciation with your vote, or else!
Tenants only matter with things like "ok, who do I send emails to today?" or my analysts wanna "fuzzy" search to get metrics on all things that have a cat on them. We can do it, but it's less than optimal which lead me to the idea of a secondary collection specifically for that analyst purpose.
Again I do not understand your use case beyond this post and the one before it.

But if you are concerned about scaling then creating a secondary collection that partitions things into more isolated datasets or volumes is a bread and butter change. You are on the right track here. If the Tenant is not the ideal partitioning point you will need to identify or create a better commonality. This design pattern is a best practice mongo or not in various situations. I would not really be concerned with duplication of data because storage costs nothing. The pain point is going to be keeping your partitions uniform if updates are inconsistent.

And I get why that this is a primary data store for you. But it is something to think about here because all of these problems are nonexistent with Kafka type streaming as the messages are immutable and you never have to deal with any of this. Hence why Mongo is less favored. I think the last time I used Mongo was like 3 years ago now.
 
Again I do not understand your use case beyond this post and the one before it.

But if you are concerned about scaling then creating a secondary collection that partitions things into more isolated datasets or volumes is a bread and butter change. You are on the right track here. If the Tenant is not the ideal partitioning point you will need to identify or create a better commonality. This design pattern is a best practice mongo or not in various situations. I would not really be concerned with duplication of data because storage costs nothing. The pain point is going to be keeping your partitions uniform if updates are inconsistent.

And I get why that this is a primary data store for you. But it is something to think about here because all of these problems are nonexistent with Kafka type streaming as the messages are immutable and you never have to deal with any of this. Hence why Mongo is less favored. I think the last time I used Mongo was like 3 years ago now.

So perhaps I can ask just one simple question: Do you/have you stored the same data in two different tables/collections before in a different style or with a different index to serve two different purposes?

If you have a team of 20 analysts that just go ham all day on the table running reports(especially ones that you cannot predict ahead of time so maybe might not be indexed because some idiot decided to group by the style of door handle on the car in a make believe car table) you obviously don't want that to have impact on the users who pay you to use the site, do you "migrate" or copy the data once it's been completed to some offline reporting database/table?

I was always taught redundancy was taboo and of course you introduce possible synchronization issues, but this just seems like the best way to handle some of these situations.
 
Last edited:
So perhaps I can ask just one simple question: Do you/have you stored the same data in two different tables/collections before in a different style or with a different index to serve two different purposes?
No, I have never used Mongo in this way. Whenever I had to use Mongo within a data platform we had a transformation layer to deal with problems such as this. From what I am getting here Mongo is your primary data store as well as the delivery point to downstream consumers. Is there a specific reason you are using it this way? What I would generally expect, because of Mongo's limitation in regards to delivering data products to end users, is using it the same way we would Kafka.

Mongo/Kafka -> Loading process into some other platform like Snowflake/Databricks -> Transformation (DBT or similar) -> End user data product (Most analysts would interact with it here) be it within the DB system or some more user friendly platform like PowerBI.
 
  • 3Like
Reactions: 2 users
Thanks for the conversation, we are a small startup so I dont have many people to talk to about this stuff.

I have 2 end users which is where I am struggling.

My customer: They log on, work together in teams, do whatever, etc. We have an end user UI(obviously) and essentially the "load" something(single pull from mongo by ID) work with it on platform in memory and "save"(update mongo by ID) when they are done. There is a bit more here that isn't relevant for this discussion such as real-time updates, blah blah. This works well.

Internal: We have companies looking to buy us, partially for our data and user base beyond a simple multiple of our revenue. What they want to do is run all sorts crazy metrics such as how many items are about cars and had more than 3 people work on them? I have the data, I can run the report, no big deal, it may be slow unless I add an index on #of people and type of item(car). Then it's fast. However I cannot predict what they want to query on.

Is that where you are talking about using snowflake/databricks?
 
  • 1Like
Reactions: 1 user
Thanks for the conversation, we are a small startup so I dont have many people to talk to about this stuff.

I have 2 end users which is where I am struggling.

My customer: They log on, work together in teams, do whatever, etc. We have an end user UI(obviously) and essentially the "load" something(single pull from mongo by ID) work with it on platform in memory and "save"(update mongo by ID) when they are done. There is a bit more here that isn't relevant for this discussion such as real-time updates, blah blah. This works well.

Internal: We have companies looking to buy us, partially for our data and user base beyond a simple multiple of our revenue. What they want to do is run all sorts crazy metrics such as how many items are about cars and had more than 3 people work on them? I have the data, I can run the report, no big deal, it may be slow unless I add an index on #of people and type of item(car). Then it's fast. However I cannot predict what they want to query on.

Is that where you are talking about using snowflake/databricks?
If you're a small shop and can sort of do whatever you want, why not pull the data into whatever format they're happiest querying against? Run an incremental pull in your low usage hours. No reason to run analytics on your live db (generally speaking).
 
  • 1Like
Reactions: 1 user
If you're a small shop and can sort of do whatever you want, why not pull the data into whatever format they're happiest querying against? Run an incremental pull in your low usage hours. No reason to run analytics on your live db (generally speaking).

Exactly what I was failing to articulate and trying to get it. Perfect. I agree i DONT want to run these types of things against live data/the users collection at all. I designed the system to be fast and simple for the people who are using it day in and day out, not for long term reporting.

So essentially I do need some form of "duplication" where I pull the data down to someplace else people can run against it. I kind of do this already but not to the extent I want or should. I already have a background batching system for another purpose so I can probably copy/pasta that and just do a different task.

The long term/big data type of scanning doesn't need to be real-time at all. It's not a health check or system heartbeat. It's just "tell me about last year" type of shit.
 
  • 1Like
Reactions: 1 user
Exactly what I was failing to articulate and trying to get it. Perfect. I agree i DONT want to run these types of things against live data/the users collection at all. I designed the system to be fast and simple for the people who are using it day in and day out, not for long term reporting.

So essentially I do need some form of "duplication" where I pull the data down to someplace else people can run against it. I kind of do this already but not to the extent I want or should. I already have a background batching system for another purpose so I can probably copy/pasta that and just do a different task.

The long term/big data type of scanning doesn't need to be real-time at all. It's not a health check or system heartbeat. It's just "tell me about last year" type of shit.
Yeah, you're basically just talking about pulling it into a data warehouse, probably flattening it for a relational structure. TJT probably has some top end tactics for that, but on the super simple side, you can probably just export to csv and then load it into sql server/mysql. I'm pretty sure that's essentially how a lot of the mongo data connectors work internally anyway. How nicely it flattens has a lot to do with your data structure though, so you may have some work reconciling that side of it too.
 
  • 1Like
  • 1Solidarity
Reactions: 1 users
Nah, we can code it. Like I said we have stuff to do similar things for when people change their name and stuff. Essentially DB triggers but at the application level. So I can already queue saves into a bucket and once an hour(or whatever time frame) dump them somewhere else with no impact to actual users.

In my head I was just torn between "i already have the data right there, why move it" and "how could I do this without hurting the real function of the system". Mongo somewhat helps by having analytic nodes, which are essentially what we are talking about. It's a replication to another spot where I can have all this type of crap run against that instead of my user DB. BUT the "flatten" statement above is key as doing so would make life a lot easier and the replica set from mongo does not flatten
 
  • 1Like
Reactions: 1 user