go to post Vitaliy Serdtsev · Oct 30, 2019 Instead of Property Product As %String [ Required ]; Property Item As %String [ Calculated, SqlComputeCode = { s {*}=$e({Product},1,5)}, SqlComputed ]; it is better to use Property Product As %String [ Required ]; Property Item As %String(MAXLEN = 5) [ Required, SqlComputeCode = { s {*}=$e({Product},1,5)}, SqlComputed, SqlComputeOnChange = Product ]; Check on the version 2017.2 can not, but checked on 2018.1 SELECT * FROM Portal.ProductStats ps left JOIN Portal.ProductCacheUpdates pcu ON (pcu.Item=ps.Item) WHERE ps.Item=? ExtentSize=1 (Portal.ProductStats) ExtentSize=1000 (Portal.ProductCacheUpdates) Relative cost = 1338 ◾Read master map Portal.ProductStats.IDKEY, looping on ID. ◾For each row: Read index map Portal.ProductCacheUpdates.pcacheUpdsProd, using the given %SQLUPPER(Item), and looping on ID. For each row: Read master map Portal.ProductCacheUpdates.IDKEY, using the given idkey value. Generate a row padded with NULL for table Portal.ProductCacheUpdates if no row qualified. Output the row. ExtentSize=1000 (Portal.ProductStats) ExtentSize=1 (Portal.ProductCacheUpdates) Relative cost = 1219.2 ◾Read index map Portal.ProductStats.pcacheUpds, using the given %SQLUPPER(Item), and looping on ID. ◾For each row: Read master map Portal.ProductStats.IDKEY, using the given idkey value. Read index map Portal.ProductCacheUpdates.pcacheUpdsProd, using the given %SQLUPPER(Item), and looping on ID. For each row: Read master map Portal.ProductCacheUpdates.IDKEY, using the given idkey value. Generate a row padded with NULL for table Portal.ProductCacheUpdates if no row qualified. Output the row. As you can see in both cases the index pcacheUpdsProd is used. Have you really set up the tables and cleared the cached queries so that the optimizer can start using the new statistics? Try to do it manually in the terminal: blablabla>d $system.SQL.TuneSchema("Portal",1), $SYSTEM.SQL.Purge(), $system.Status.DisplayError($system.OBJ.CompilePackage("Portal","cu-d"))
go to post Vitaliy Serdtsev · Oct 30, 2019 The documentation describes in detail how and why. For example, sometimes the optimizer decides not to use the index if a full crawl would be more efficient. It depends on many parameters: ExtentSize, Selectivity, etc. Give here what Robert asks, and it will be possible to tell more precisely why.
go to post Vitaliy Serdtsev · Oct 30, 2019 [Caché SQL Optimization Guide > Introduction to SQL Performance Optimization] In most cases, helps "tune table". But you can try hints (%ALLINDEX, %FIRSTTABLE, etc.)
go to post Vitaliy Serdtsev · Oct 30, 2019 Try this: update RB_ResEffDateSessPayorRestr set RESTR_DATETo=to_date(DATEADD('year',1,RESTR_DATETo),'YYYY-MM-DD') where YEAR(RESTR_DATETo)=2020Or this: update RB_ResEffDateSessPayorRestr set RESTR_DATETo=%odbcin(DATEADD('year',1,RESTR_DATETo)) where YEAR(RESTR_DATETo)=2020
go to post Vitaliy Serdtsev · Oct 7, 2019 &SQL(SELECT ID FROM Cinema.Film ORDER BY ID DESC) similar to the query &SQL(SELECT TOP ALL ID FROM Cinema.Film ORDER BY ID DESC) Therefore, it is natural that the query plans &SQL(SELECT TOP ALL ID FROM Cinema.Film ORDER BY ID DESC) and &SQL(SELECT TOP 1 ID FROM Cinema.Film ORDER BY ID DESC) are so significantly different.
go to post Vitaliy Serdtsev · Sep 23, 2019 Class dc.test Extends %RegisteredObject { ClassMethod Run( a, b) { w $$$FormatText("a=%1, b=%2",$g(a,"<null>"),$g(b,"<null>")),! } ClassMethod Test() { s cName="dc.test", mName="Run", args=2, args(1)="2019-01-01", args(2)="1,2,3,4" d $classmethod(cName,mName,args...) k args s args=1, args(1)=77 d $classmethod(cName,mName,args...) k args s args=2, args(2)=33 d $classmethod(cName,mName,args...) k args s args="" d $classmethod(cName,mName,args...) } } Result: USER>d ##class(dc.test).Test() a=2019-01-01, b=1,2,3,4 a=77, b=<null> a=<null>, b=33 a=<null>, b=<null>
go to post Vitaliy Serdtsev · Sep 18, 2019 The field TimeCreated is of type Ens.DataType.UTC. Then so: datepart('hh', %external(TimeCreated))See Data Display Options
go to post Vitaliy Serdtsev · Sep 17, 2019 It's a challenge. Give a reproducible example for "play around". There are a bunch of hints: Query Optimization. @Kyle.Baxter will also be interested in your issue.
go to post Vitaliy Serdtsev · Sep 17, 2019 At me in SMP the following query returns 23: select datepart('hh', {ts '2019-09-10 23:01:45'})
go to post Vitaliy Serdtsev · Jul 30, 2019 By default, the mac address of the computer on which the DBMS instance is running is returned. But you can get the mac address of any other computer, see getmac /?.
go to post Vitaliy Serdtsev · Jul 29, 2019 I checked for versions 2009.1/2010.1: unfortunately, the $zu(114,0) returns nothing, therefore, remains variant with the command line. Example for Windows, provided that the system has a single network card: #include %syConfig n result w $zu(144,1,$$$DEFETHADDR),!,"------",! d $system.OBJ.DisplayError(##class(%Net.Remote.Utility).RunCommandViaCPIPE("getmac /NH /fo table",,.result)) w $p(result," ",1)PS: for other OS command line may be different.
go to post Vitaliy Serdtsev · Jul 25, 2019 I know. After all the author requested the solution on pure M and not COS.
go to post Vitaliy Serdtsev · Jul 25, 2019 Try this: w $zu(114,0) or w $$$DEFETHADDR ; from %syConfig.inc
go to post Vitaliy Serdtsev · Jul 24, 2019 Important note: it should be noted that the proposed solutions refer only to the port of the private web server, which may not even be installed. In the case of an external web server, this is not possible.
go to post Vitaliy Serdtsev · Jul 24, 2019 Thank you for your comment. This code is taken from the source code %SYS, which in theory should be an example for application developers. I hope that InterSystems developers will see your comment and make appropriate changes.
go to post Vitaliy Serdtsev · Jul 16, 2019 See $(REST - CSP - (-HyperEvents) + EasyUI + File Upload). Part 2
go to post Vitaliy Serdtsev · Jul 16, 2019 Intel i5-2400 10000 digits ~ 58 sec. calcPI(n) public { s $lb(len,nines,predigit,r)=$lb(10*n\3,0,0,"") f i=1:1:len s a(i)=2 f j=1:1:n { s q=0 f i=len:-1:1 s x=10*a(i)+(q*i), a(i)=x#(2*i-1), q=x\(2*i-1) s a(1)=q#10, q=q\10 i q=9 { s nines=nines+1 }elseif q=10 { s r=r_(predigit+1)_$$repeat^%qarfunc(0,nines), predigit=0, nines=0 }else{ s r=r_predigit, predigit=q s:nines r=r_$$repeat^%qarfunc(9,nines), nines=0 } } q r_predigit }
go to post Vitaliy Serdtsev · Jul 12, 2019 And if so? w $zobjref(^||PPG(1)).NameStill take a look at $$$objOrefToInt/$$$objIntToOref (%occObject.inc) PS: it should be noted that OREF ≠ OID and serve different purposes.