Re: sqlYoga queries
Thanks Trevor. I'll give it a go. Bob S > On Jul 26, 2022, at 08:47 , Trevor DeVore via use-livecode > wrote: > > On Tue, Jul 26, 2022 at 10:08 AM Bob Sneidar via use-livecode < > use-livecode@lists.runrev.com> wrote: > >> sqlYoga can define table objects and relations in a database object. >> Heretofore I have not availed myself of this, being content to only work >> with query objects and record objects. Now as I am trying to optimize this >> new socket agent I wrote, I am wondering if a single query for all the data >> for a given customer/site/device would be more time efficient than multiple >> queries for each table. So the question is, if I were to use table and >> relations, could I craft a statement so that it perfoms a single query? >> > > Hi Bob, > > So table/relationship objects in SQL Yoga aren't required here. You can set > the `related table joins` (or just `joins`) property of a SQL Query Object. > See docs: > https://github.com/trevordevore/sql-yoga/wiki/SQL-Yoga-API#sqlquery_set > > Per the docs, if you have table and relationship objects defined you can > use shorthand to set the property. You can just use the longhand approach > to run some tests and see if your code runs faster with a single query that > returns data from multiple tables vs multiple queries that query each table > individually. > > -- > Trevor DeVore > ScreenSteps > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: sqlYoga queries
On Tue, Jul 26, 2022 at 10:08 AM Bob Sneidar via use-livecode < use-livecode@lists.runrev.com> wrote: > sqlYoga can define table objects and relations in a database object. > Heretofore I have not availed myself of this, being content to only work > with query objects and record objects. Now as I am trying to optimize this > new socket agent I wrote, I am wondering if a single query for all the data > for a given customer/site/device would be more time efficient than multiple > queries for each table. So the question is, if I were to use table and > relations, could I craft a statement so that it perfoms a single query? > Hi Bob, So table/relationship objects in SQL Yoga aren't required here. You can set the `related table joins` (or just `joins`) property of a SQL Query Object. See docs: https://github.com/trevordevore/sql-yoga/wiki/SQL-Yoga-API#sqlquery_set Per the docs, if you have table and relationship objects defined you can use shorthand to set the property. You can just use the longhand approach to run some tests and see if your code runs faster with a single query that returns data from multiple tables vs multiple queries that query each table individually. -- Trevor DeVore ScreenSteps ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
sqlYoga queries
Hi. This is directed at Trevor Devore, although if anyone else knows they can chime in. sqlYoga can define table objects and relations in a database object. Heretofore I have not availed myself of this, being content to only work with query objects and record objects. Now as I am trying to optimize this new socket agent I wrote, I am wondering if a single query for all the data for a given customer/site/device would be more time efficient than multiple queries for each table. So the question is, if I were to use table and relations, could I craft a statement so that it perfoms a single query? Bob S ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode