From: Brent Gracey <brentgra...@gmail.com>
Date: Wed, 14 Nov 2012 02:51:17 -0800 (PST)
Local: Wed, Nov 14 2012 5:51 am
Subject: Re: [mongodb-user] Re: any alternative to client side processing in place of what would be a RDMS join?
Hi - so I done some logging to work out what is taking the time First, a big correction - I'm actually hitting the db 2000 times, not 200, Logging from my application code 09:27:31.409 [qtp741338313-114 - /man/json/counts] DEBUG I enabled db.setProfilingLevel(2) - and after capturing commands for just > db.system.profile.find().count() 2845 Then I ran a summary - to just group everything and give a total "db" run db.system.profile.group( } ); OUTPUT [ } ] On Tuesday, November 13, 2012 2:22:58 PM UTC, Sammaye wrote:
> At 200 records it should be giving 0 overhead. > You are right that the initial post was a little tl;dr. I definitely > So let's start fresh: if you turn on logging for MongoDB and check the log > On 13 November 2012 13:39, Brent Gracey <brent...@gmail.com <javascript:>>wrote: >> Thanks for the reply, >> I know very well that joins in SQL can have their own nuances, but feel >> My current situation is I am doing multiple detail queries - and the >> I haven't got the exact breakdown of what is taking the time - so can't >> Thanks >> On Tuesday, November 13, 2012 12:32:19 PM UTC, Sammaye wrote: >>> "You have got to consider that in MySQL" >>> Sorry I mean any SQL tech there. >>> On 13 November 2012 12:31, Sam Millman <sam.m...@gmail.com> wrote: >>>> "If I do a query to the db for each detail record then I get 100s of db >>>> You only get one, and it should be a persistent one. >>>> "If I pull all the detail records in one query - then the client side >>>> Indexes on JOINs are a questionable matter, I have seen many many times >>>> You have got to consider that in MySQL the client side "detail" lookup >>>> MongoDB is quite different in how it queries, it is used to querying in >>>> There is one caveat you will get into soon however, which I think needs >>>> On 13 November 2012 11:10, Brent Gracey <brent...@gmail.com> wrote: >>>>> Hi William - thanks again for the detailed reply >>>>> I can see how doing this for a query that requires information for one >>>>> If I pull all the detail records in one query - then the client side >>>>> If I do a query to the db for each detail record then I get 100s of db >>>>> So my understanding is I would need to update my data structure to >>>>> On Monday, October 29, 2012 5:40:26 PM UTC, William Zola wrote: >>>>>> Hi Brent! >>>>>> Sorry for taking so long to get back to you. >>>>>> The answer to your question is: the database is not going to be any >>>>>> 1) Let's begin by looking at how you'd do this in SQL: >>>>>> CREATE TABLE dept (deptno NUMBER CONSTRAINT pk_dept PRIMARY KEY, >>>>>> First off: this creates two indexes "behind your back": one on >>>>>> Second: consider how you would query these tables: >>>>>> SELECT empid, ename FROM emp, dept >>>>>> Note that unless you index 'emp.deptno', this query is going to be >>>>>> You're now at no less than FOUR indexes. >>>>>> This query is going to force the RDBMS to do the following: >>>>>> 2) Now, let's consider how to do this in MongoDB. For legibility, >>>>>> > db.dept.save( {_id: 1, name: 'Sales'} ); >>>>>> > db.emp.save( { _id: 1, name: 'Ben', dept: 1 } ); >>>>>> To make this efficient, I'll create a secondary index on the 'dept' >>>>>> > db.emp.ensureIndex( dept: 1 ); >>>>>> By default, there are already indexes on "dept._id" and "emp._id". >>>>>> To find all of the employees in the "Support" department, I need to >>>>>> > result = db.dept.findOne({name: 'Support'}, {_id:1} ); >>>>>> In terms of the actual work done, there are the same number of >>>>>> Let me know if you have further questions. >>>>>> -William >>>>>> On Thursday, October 18, 2012 3:19:54 PM UTC-7, Brent Gracey wrote: >>>>>>> Hi - thanks for the comprehensive reply - I'm still working through >>>>>>> Yes the database application would have to join - but assuming it >>>>>>> for all x in array X >>>>>>> My assumptions for this are: >>>>>>> There is overhead in maintaining DB indexes - this has already been >>>>>>> So I can't see how client side processing can be as efficient as >>>>>>> Main point of the post if for people to point out if any of my >>>>>>> Thanks >>>>>>> On Sunday, October 7, 2012 11:06:38 AM UTC+1, Brent Gracey wrote: >>>>>>>> If a data set & use cases are focused on "relational" work - would >>>>>>>> Would it be possible to use a map reduce function which operates >>>>>>>> I guess foursquare have some way of answering those sorts of >>>>>>>> (this is a shortened version of half of post https://groups.google. >>>>>>>> Regards, >>>>>>> -- >>>>> To unsubscribe from this group, send email to >>>>> See also the IRC channel -- freenode.net#mongodb >>> -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||