Re: QUERY into variable vs. Records in Table

2017-10-20 Thread Arnaud de Montard via 4D_Tech
> Le 19 oct. 2017 à 19:22, Pat Bensky via 4D_Tech <4d_tech@lists.4d.com> a > écrit : > > I'd have thought Records in Table would be quicker ... I'm sure 4D already > "knows" how many records there are in each table, so it can just answer > that question immediately rather than having to query

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread David Adams via 4D_Tech
> And all it's doing is waiting for a relatively rare condition to happen (and a record to appear in this table). It might > happen at most once or twice per day, maybe only once every few days, but when it happens it has to be dealt with > immediately. It's such a waste to be constantly

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Kirk Brooks via 4D_Tech
Hi Jeff, On Thu, Oct 19, 2017 at 10:28 AM, Jeffrey Kain via 4D_Tech < 4d_tech@lists.4d.com> wrote: > ​... > all it's doing is waiting for a relatively rare condition to happen (and a > record to appear in this table). It might happen at most once or twice per > day, maybe only once every few

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Tim Nevels via 4D_Tech
On Oct 19, 2017, at 1:45 PM, Jeffrey Kain wrote: > Decided to test it. Here are the results, running interpreted, client-server > against a server under very low load: > > Records in table: 565 ms > Semaphore polling: 2482 ms > Query into variable: 2749 ms Makes sense to me if you think like

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Jeffrey Kain via 4D_Tech
Great idea - I think that would actually work for what I need... Thanks! -- Jeffrey Kain jeffrey.k...@gmail.com > On Oct 19, 2017, at 2:45 PM, Spencer Hinsdale via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > maybe i don't understand but what about: > > `trigger > execute on

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Spencer Hinsdale via 4D_Tech
maybe i don't understand but what about: `trigger execute on client("@";"flagPoll") `flagPoll c_boolean(<>flagPoll) <>flagPoll:=true ... if(<>flagPoll) > $x:=Records in table([ServerMigrations]) <>flagPoll:=false else `skip 99,999 calls to server end if > On Oct 19, 2017,

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Jeffrey Kain via 4D_Tech
Decided to test it. Here are the results, running interpreted, client-server against a server under very low load: Records in table: 565 ms Semaphore polling: 2482 ms Query into variable: 2749 ms Here's my test code: C_LONGINT($msRIT;$msSEM;$msQUERY;$x;$n) C_BOOLEAN($b) $n:=1000

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Spencer Hinsdale via 4D_Tech
trigger? > On Oct 19, 2017, at 10:28 AM, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > I feel like I'm missing an obvious solution. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html

RE: QUERY into variable vs. Records in Table

2017-10-19 Thread Timothy Penner via 4D_Tech
I am not sure why you would be comparing QUERY into variable vs. Records in Table - did you really mean Records in Selection, not Table? QUERY into variable would require a query which would probably be slower (due to a query). Records in Table ignores any selection and just returns the number

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Julio Carneiro via 4D_Tech
Jeffrey, I did not quite get your question. Records in Table does not relate to QUERY in any way, because you are comparing a sort of static number, total records in a table, to the result of a dynamic operation. Did you mean compare: Set Query Destination(into variable;$nrecs)

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Jeffrey Kain via 4D_Tech
We've been using the new Get Database Measures command to take a look at what our application is actually doing, and plotting some of these metrics to our dashboard... for example, most frequently run queries. This particular query popped to the top, executing a few hundred times per minute.

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Pat Bensky via 4D_Tech
I'd have thought Records in Table would be quicker ... I'm sure 4D already "knows" how many records there are in each table, so it can just answer that question immediately rather than having to query and count the result ... Pat On 19 October 2017 at 17:28, Dennis, Neil via 4D_Tech

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Jeffrey Kain via 4D_Tech
I was thinking that I could just create a semaphore instead of creating a record. The code that would otherwise be querying would just be calling Test Semaphore... but a method to clear that semaphore would be tricky since only the process that creates it can kill it. And I kind of wonder if

Re: QUERY into variable vs. Records in Table

2017-10-19 Thread Arnaud de Montard via 4D_Tech
> Le 19 oct. 2017 à 18:25, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> a > écrit : > > Does anyone know the relative performance impact on a server of calling a > QUERY wrapped inside a SET QUERY DESTINATION (Into Variable...), compared to > calling Records In Table? > > If you had to do

QUERY into variable vs. Records in Table

2017-10-19 Thread Jeffrey Kain via 4D_Tech
Does anyone know the relative performance impact on a server of calling a QUERY wrapped inside a SET QUERY DESTINATION (Into Variable...), compared to calling Records In Table? If you had to do one a hundred times a minute or more, which would you choose? I'm guessing the server can get the