sqlYoga queries

Trevor DeVore lists at mangomultimedia.com
Tue Jul 26 11:47:58 EDT 2022


On Tue, Jul 26, 2022 at 10:08 AM Bob Sneidar via use-livecode <
use-livecode at 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


More information about the use-livecode mailing list