1. A method of implementing a many-to-many relationship among objects defined for business entities or business activities using database tables in an on-demand database service, the method comprising: receiving information associated with a plurality of arbitrary objects defined in the on-demand database service; defining a custom junction object comprising a many-to-many relationship of any tuple selected from the plurality of arbitrary objects, wherein the custom junction object includes at least a first direct parent-child relationship implementing the many-to-many relationship that includes a first parent object and a plurality of child objects, and a second parent-child relationship that includes a second parent object, and the plurality of child objects; storing in the on-demand database service, custom junction objects including information about related tuples of arbitrary objects using the custom junction object defined; defining one or more read-write security criteria associated with the custom junction object and enforcing the read-write security criteria, wherein the read-write security criteria applicable to the child objects depend on a combined evaluation of read-write security criteria applicable to both the first parent object and the second parent object; receiving from a source a first query of a pipeline of queries that when run return a predetermined number of temporally ordered entities associated with a plurality of accounts of the on-demand database service; running the first query for a predetermined number of temporally ordered entities associated with a first account; limiting a second query for temporally ordered entities associated with a second account by conditionally retrieving at least one of temporally ordered entities associated with a second account based on a determination whether a date associated with the at least one of the temporally ordered entities would result in the at least one of the temporally ordered entities not being included in the predetermined number of temporally ordered entities; and using the custom junction object to provide a result to at least one query, wherein visibility of child objects in the result is determined by visibility to the source of the first parent object and visibility to the source of the second parent object; thereby ensuring that the source receives in the result only business entities or business activities of child objects whose parent objects are visible to the source.