APM
Upgrade or Update APM to V5.2.1.0.0
Upgrading or updating and configuring APM includes completing multiple steps, which are outlined in the tables in this section. This section of the documentation provides all the information that you need to upgrade or update and configure the basic system architecture to V5.2.1.0.0.
After you have completed these steps, you will need to perform additional steps required to upgrade any modules that were deployed on your previous version. If you have purchased additional modules for use with APM, then you will also need to consult the first-time deployment documentation for each of those modules and features.
The person responsible for completing each task may vary within in your organization. We recommend, however, that the steps be performed in relatively the same order in which they are listed in the table.
Upgrade from | Upgrade to | Procedure |
---|---|---|
V5.2.x | V5.2.1.0.0 | Upgrade from any version V5.2.0.0.0 through V5.2.0.1.0 |
V5.1.x | V5.2.1.0.0 | Upgrade from any version V5.1.0.0.0 through V5.1.3.1.0 |
V5.0.x | V5.2.1.0.0 | Upgrade from any version V5.0.1.0.0 through V5.0.6.0.0 |
V4.6.2 or a later V4.6.x release | V5.2.1.0.0 | Upgrading or updating to the V5.2.1.0.0 is a two-step process. You need to first upgrade to APM V5.0.x and then follow the steps to upgrade to V5.2.1.0.0. Note: For more information on upgrading to APM V5.0.x, refer to the Upgrade documentation for the corresponding version. You can view version specific documentation here. |
V4.6.1.x or earlier | V5.2.1.0.0 | Upgrading or updating to the V5.2.1.0.0 is a two-step process. You need to first upgrade to APM V5.0.x and then follow the steps to upgrade to V5.2.1.0.0. Note: For more information on upgrading to APM V5.0.x, refer to the Upgrade documentation for the corresponding version. You can view version specific documentation here. |
Upgrade from any version V5.2.0.0.0 through V5.2.0.1.0
To apply this release, complete the following steps:
Procedure
- On each APM Server, including both dedicated and supporting instances, uninstall the APM Server Components..
- Login to the GE Vernova Redis server.
- Connect to Redis using the redis-cli.
- Run
flushall
to clear Redis across the cluster. - On each APM Server, including both dedicated and supporting instances, install the APM Server Components..
- Upgrade the APM Database.
- Install this release to mobile devices using an iOS, Android, or Windows operating system by following the standard documentation for installing the GE Digital APM mobile application.
Upgrade from any version V5.1.0.0.0 through V5.1.3.1.0
To apply this release, complete the following steps:
Procedure
- On each APM Server, including both dedicated and supporting instances, uninstall the APM Server Components..
- Login to the GE Vernova Redis server.
- Connect to Redis using the redis-cli.
- Run
flushall
to clear Redis across the cluster. - On each APM Server, including both dedicated and supporting instances, install the APM Server Components..
- Upgrade the APM Database.
- Install this release to mobile devices using an iOS, Android, or Windows operating system by following the standard documentation for installing the GE Digital APM mobile application.
Upgrade from any version V5.0.1.0.0 through V5.0.6.0.0
To apply this release, complete the following steps:
Procedure
- On each APM Server, including both dedicated and supporting instances, uninstall the APM Server Components..
- Login to the GE Vernova Redis server.
- Connect to Redis using the redis-cli.
- Run
flushall
to clear Redis across the cluster. - On each APM Server, including both dedicated and supporting instances, install the APM Server Components..
- Upgrade the APM Database.
- Install this release to mobile devices using an iOS, Android, or Windows operating system by following the standard documentation for installing the GE Digital APM mobile application.
Upgrade or Update the APM Server to V5.2.1.0.0
About This Task
The following instructions provide details on upgrading or updating the APM Server and Add-ons software on a 64-bit APM Server machine.
Procedure
Uninstall APM Server Components After the Initial Installation
About This Task
If you need to uninstall APM Server on a machine after the initial installation is complete, you can run the APM Server installer again to uninstall the software.
Procedure
Upgrade the APM Adapter for SSRS to APM
About This Task
The following instructions assume that you were using the 64-bit APM Adapter for SSRS in your previous version. If you were using the 32-bit APM Adapter for SSRS, you will need to uninstall the older 32-bit version and install the new 64-bit version on a 64-bit SQL Server Report Server.
Procedure
What To Do Next
Upgrade the APM Database to V5.2.1.0.0
To upgrade your APM database, you will use the APM Database Migrator.
During the database upgrade process, the APM Database Migrator will:
- Update the baseline database content in your database with the updated baseline APM database content.
- Compare your public database content to the baseline APM database content, and then:
- Retain any customized database content.
- Replace any database content that you have not customized in your database with the updated baseline database content.
- Record every event in the database upgrade to the console's standard output.
- Report errors as they occur to the console's standard error.
- Display a confirmation message,
Migration complete
, when the database upgrade process is complete.
Migrations complete
message will appear, otherwise, the migrator will exit early with any error information sent to the standard output/error.Upgrade failure of this kind can be safely avoided by temporarily modifying the database recovery mode to SIMPLE before running the upgrade and then resetting it to FULL after the upgrade. Your database administrator can use the following commands to modify the database recovery mode:
To put the database in SIMPLE recovery mode:
USE [master]
GO
ALTER DATABASE [mydb] SET RECOVERY SIMPLE WITH NO_WAIT
GO
To put the database in FULL recovery mode:
USE [master]
GO
ALTER DATABASE [mydb] SET RECOVERY FULL WITH NO_WAIT
GO
For more information about SQL Server database recovery modes, consult the Microsoft documentation.
Upgrade workflow
The table in this section lists the prerequisite tasks that must be completed before you initiate the database upgrade process. These instructions assume that yourAPM Server and APM Database Server machines meet the APM hardware and software requirements. You can use the Database Upgrade Manager to upgrade a database from any version V3.4.0 SP3 or later to your target version. Details on upgrading from a starting version that is earlier than V3.4.0 SP3 are not provided in this documentation. For more information on upgrading your database from a version earlier than V3.4.0 SP3, contact the APM Professional Services department.
Step |
Task |
Notes |
---|---|---|
1 |
Complete all steps before Upgrade the Meridium Enterprise APM Database Server in the upgrade APM to APM workflow. |
This step is required. For example, if you are upgrading your system to APM, you should upgrade your dedicated APM Server to APM before attempting to upgrade your database to the APM database version. Doing so ensures that your machine contains the latest database content file, which is a compressed folder containing the content of the baseline APM database for the target database version. |
2 |
Read and understand how your customizations will be protected during the upgrade process. |
You will need to understand how your content is protected to determine what, if any, content you should export from your pre-upgrade database before initiating the database upgrade process. |
3 |
Create a backup of your database. |
You should always back up the database before beginning any upgrade process. If any problems occur during the upgrade, the database can then be restored to its original state from the backup copy. |
4 | Log in to Oracle Server 12.2 as a privileged user, and then run the following command: SQL> GRANT SELECT ANY DICTIONARY TO <user>; ...where <user> is the name of the user that you created when you created the APM Oracle Schema on the APM Database Server. | |
5 |
Using a backup copy of your database, perform the upgrade in a test environment. |
We recommend that you perform the upgrade in a test environment so that you can assess any issues that you may encounter and correct them before upgrading your database in a production environment. |
6 | Log in to SQL*Plus (or equivalent) as the schema owner, and then run the following command: SQL> EXEC MI_DDL.CRT_SIDX_SI_MI_GEOD_GD |
This step is required only if both of the following are true:
|
7 | Run the BinaryToJSON utility. | This step is required only if:
|
8 | Perform the upgrade in the production environment. |
This step is required. Note: Before you upgrade your database in a production environment, all the issues that were discovered during the test upgrade must be resolved. Otherwise, the resulting state of your database could be unstable.
|
9 | Log in to Oracle Server 12.2 as a privileged user, and then run the following command: SQL> REVOKE SELECT ANY DICTIONARY FROM <user>; ...where <user> is the name of the user that you created when you created the APM Oracle Schema on the APM Database Server. | |
10 | If your pre-upgrade database employed Enterprise Data Filtering and you want to convert your Enterprise Data Filtering values to Site Reference Keys, consult a member of the APM Professional Services department for more information. |
This step is optional. If your pre-upgrade database did not employ Enterprise Data Filtering or you do not want to convert your existing Enterprise Data Filtering values to Site Reference Keys, then skip this step. |
11 | Modify each custom family that you do not want to be enabled for site filtering. |
During the upgrade, custom families are set to be enabled for site filtering. For each custom family that you do not want to be enabled for site filtering, you must modify the family by clearing the Enable Site Filtering check box in the Information section of the workspace for the family. |
12 | Confirm that Site Reference Keys were populated correctly during the upgrade. Modify the site assignments for records as needed. |
This step is required. To support site filtering, a APM Default site was added to the Site Reference family during the database upgrade. If the APM Default site is the only site in your Site Reference family, then records of families that are enabled for site filtering are assigned to it. If there are two sites in your Site Reference family (i.e., the APM Default site and one other site), then records of families that are enabled for site filtering are assigned to the site that is not APM Default site. During the upgrade, additional logic is used, based on a record’s specific relationships with other records, to assign a site for each record belonging to a family that is enabled for site filtering. Note:
The manner in which Site Reference Keys are spread across families to assign sites to records can vary from module to module. If you have questions about how Site Reference Keys were populated during the upgrade, contact the APM Professional Services department. If a record's site assignment could not be populated automatically during the upgrade, then the record is designated as a global record (i.e., it is not assigned to any specific site). For some records, the site assignment may need to be modified by a Super User. |
13 | Verify that users' site assignments and default sites are correct . Assign default sites to any users who do not have one. |
This step is required. To support site filtering, a APM Default site was added to the Site Reference family. If the APM Default site is the only site in your Site Reference family, then all users are assigned to it, and it is set as their default site. If there are two sites in your Site Reference family (i.e., the APM Default site and one other site), then all users are assigned to the site that is not APM Default site, and the site that is not APM Default site is set as each user's default site. If there are three or more sites in your Site Reference family (i.e., the APM Default site and two or more other sites), then no default site is set for users. If there are three or more sites in your Site Reference family, then you must verify site assignments and assign a default site for each user. |
14 | If the system from which you upgraded utilized an Oracle Database Server, then configure the APM Server for Oracle components. | This step is required only if the system from which you upgraded utilized an Oracle Database Server. |
15 | Remove database notification elements from the database. | This step is not mandatory, but is recommended by APM. |
16 | In APM, build the search index. | This step is not mandatory, but is recommended by APM. |
About Customized Database Content Protection
Illustration of content protection
Consider a scenario where Datasheet A exists in the baseline APM database and you want to upgrade a database in which Datasheet A has been customized (e.g., you added a new field). The following diagram illustrates what the two databases would contain in this case, where the squares represent the unchanged baseline datasheet and the hexagon indicates the same baseline datasheet with your customizations.
When this database is upgraded to the new database version, only the baseline version of Datasheet A will be replaced in your database, as illustrated in the following diagram.
In this way, all your custom changes are retained. Likewise, however, your database will not contain the baseline changes that APM delivers in a given release . For this reason, you will want to determine which database items will be retained in your database so that you can determine which baseline changes your database will not contain after you upgrade. With that information, you can determine whether you want to:
-
Continue to use your database content as is, without APM's changes
-or-
-
Apply APM's changes manually to your customized database content.
Database content replacement versus protection
In general, you can assume that all the custom changes you have made to your database content will be retained in your upgraded database. In addition, you can assume that for any custom change that is protected in your database, your database will not contain any baseline changes that APM delivers for that item in a given release. In other words, if APM delivers updated changes to the baseline version of an item that you have customized in your database, you will not receive those changes because your custom changes will take precedence over the baseline changes. As a result, you should evaluate each baseline change that is delivered to determine if you want to apply those changes to your database content.
You can use the Database Comparison Tool (in pre-upgrade mode) to determine what content will be protected in your database. The output of this tool indicates:
-
The baseline APM database content that has been updated in the target version (i.e., content that includes new baseline changes from APM).
-and-
- Among the content that has been updated in the baseline APM database, that which you have customized in your pre-upgrade database.
Using a combination of the results from the Database Comparison Tool and your understanding of the content protection criteria, you can predict which baseline database content changes will not be available in your upgraded database. For example, consider the following scenario in which the Database Comparison Tool indicates that the baseline query Available Recommendations has been updated in the baseline APM database for your target version and that you have customized the Available Recommendations query in your pre-upgrade database.
In this case, you can assume that your upgraded database will contain:
-
Your public version of the Available Recommendations query with all your customizations (in the Public Catalog folder).
-
The updated baseline Available Recommendations query only in the Baseline folder.
Before you upgrade your database, you can use the Database Comparison Tool to view the specific differences between the Available Recommendations query in the baseline APM database for the target version and the same baseline query as it exists in your current version. For example, you could see that APM has added the Asset Description column to the baseline query. At this point, you can decide whether or not you want to either manually apply that change to your custom query after you upgrade or manually replace your public query with the baseline query in the Baseline folder.
Protected database content
The following table lists the types of content that exist in your database and indicates whether customizations to an existing baseline item of that type will be protected during the database upgrade process.
For items in which your customizations will not be protected during an upgrade, to maintain your customizations, you will need to export your customized items from your pre-upgrade database using the Import/Export tool, and then import them into the upgraded database. Alternatively, you can customize the items again, manually, in the upgraded database.
For some attributes of families and family fields, APM may make a change in the baseline database that will be applied to your database, regardless of whether you have customized that item or not. In these cases, the affected content will not be protected. APM will, however, communicate such changes via the release notes for that version (i.e., in the content changes section). For example, if a family caption changes in the baseline database, your database should contain this change. Therefore, if you have made changes to the same family's caption, your customization will be overwritten. You can, however, obtain the baseline content after you upgrade your database.
Baseline Database Content Type | Protected? | Notes |
---|---|---|
Family attributes (Entity and Relationship) | ||
Associated Pages |
Yes |
Associated Pages are considered one database item per family. This means that if you customize one Associated Page (of many), the database upgrade process will consider all the Associated Pages for that family as customized. |
Family description |
Yes |
None |
Family captions |
Yes |
None |
ID Template |
Yes |
None |
Family help text |
Yes |
None |
Datasheets
|
Yes |
A single datasheet is considered one database item. This means that if you customize any attribute of a datasheet, the database upgrade process will consider the entire datasheet as customized. |
Field attributes | ||
|
Yes |
The UTC property will be protected based on whether records exist for the family to which the field belongs. If records exist in a family, the field property will be protected. In other words, if APM sets the UTC property in a baseline field to True and you already have records in the family to which that field belongs, you will not receive the updated property setting automatically. |
Catalog Items | ||
Metric Views |
No |
Baseline Metric Views are always overwritten with the updated baseline Metric View. |
Queries |
Yes |
None |
Reports |
Yes |
None |
Graphs |
Yes |
None |
Security Groups | ||
Security Group caption |
Yes |
None |
Security Group ID |
Yes |
None |
Security Group description |
Yes |
None |
Security Group privileges |
No |
Baseline Security Group privileges are always overwritten with the updated baseline Security Group privileges. |
Records and links between records | ||
Records |
Yes (with some exceptions) |
After baseline records for a given family exist in your database, the records in that family will never be overwritten or updated during the database upgrade process, even if you have not customized them in any way. This means that if APM delivers updates to the existing baseline records or adds additional baseline records in a given family, you will not receive those changes by default. If this occurs, you can choose to perform an additional step to manually obtain the new records or revert your existing records to baseline. There are, however, several families whose records are not protected in this way. The following baseline families are considered recurring exceptions to the rule that all records and links are protected. This means that the database upgrade process will overwrite the baseline records in these families. In other words, all the baseline records in the following families will always be overwritten in your database with the updated baseline records:
This means that if you have customized any baseline record in one of the families in the preceding list, because all the baseline records are overwritten, your changes will be overwritten. |
Links between records |
Yes |
When the records are protected, the relationships that link the records together are also maintained with that record. |
Groups of records and links that make up a single entity (e.g., Baseline Risk Matrix) |
Yes |
A group of records and links that make up a single entity, also known as a composite entity, is treated as one entity for the purposes of the database upgrade process and content protection. After such an entity exists in your database, it will never be overwritten or updated during the database upgrade process, even if you have not customized the records and links in any way. |
State Configuration | ||
State Configuration Roles |
No |
Baseline State Configuration Roles are always overwritten with the updated baseline State Configuration Roles. |
State Configuration Role Description |
Yes |
None |
State Configuration Role Caption |
Yes |
None |
State Role Security Group assignments |
Yes |
None |
Strategy Rules and Strategies |
Yes |
None |
Other content | ||
System Codes and System Code Tables |
Yes |
None |
Preferences |
Yes |
None |
UOMs and UOM Conversion Sets |
Yes |
None |
Scheduled Items |
Yes |
None |
Rules Library Projects |
Yes |
None |
Run the BinaryToJSONConvertor Utility
About This Task
Procedure
Initiate the Database Upgrade Process
About This Task
- Comparing available migrations against migrations already applied to your database.
- Applying any new migrations to your database in alpha-numeric order.
The most common migrations will load baseline database content into your database and apply that content to your database while protecting your customized items according to the content protection process.
The following instructions assume that your dedicated APM Server already contains the version of the APM software that corresponds to the database version to which you want to upgrade your database, and that you are ready to upgrade your database in either a test or production environment.
Procedure
What To Do Next
Configure the APM Server for Oracle Components
About This Task
When installing versions of Meridium APM prior to V4.0.0.0, you were instructed to modify the following files on the dedicated APM Server machine to bind the 64-bit .Net Framework to the Oracle.DataAccess component:
- C:\WINDOWS\Microsoft.NET\Framework64\V2.0.50727\CONFIG\machine.config
- C:\Windows\Microsoft.NET\Framework64\V4.0.30319\CONFIG\machine.config
The modifications from previous releases are no longer necessary with ODAC version 11.2.0.3 and must be removed. The following instructions provide details on removing the modifications from these files.
Procedure
What To Do Next
- Refer to the APM Database Server upgrade workflow.
Remove Database Notification Elements from the Database
About This Task
Procedure
What To Do Next
- Refer to the APM Database Server upgrade workflow.
Tips to Improve Performance
Although pagination helps improve the performance of queries, it cannot help while exporting data, using crosstab queries created from Select queries with plenty of rows, returning character large objects (CLOBs) to the client, and so on. This impacts the server-side memory, client-side memory, and the network bandwidth.
This topic provides suggestions to improve the performance of queries in other possible ways.
Avoid Full Table Scans
- Database Indexes
- The database team profiles the database performance periodically and maintains indexes as needed. However, if there is a need for a new index, reach out to the database team.
- Outer Joins
- Outer joins result in full table scans. Therefore, you must avoid them wherever possible. Example:
SELECT d.name, d.deptno, e.name, e.mgr, d.loc FROM dept d LEFT OUTER JOIN emp e ON d.deptno = e.deptno
- OR Conditions
- OR conditions can slow down the query performance in large tables. Consider using a UNION instead of OR to avoid a full table scan.For example, the following code sample...
can be rewritten as follows:SELECT [MI_EQUIP000].[MI_EQUIP000_EQUIP_ID_C] "Equipment ID" , [MI_EQUIP000].[MI_EQUIP000_EQUIP_SHRT_DESC_C] "Equipment Short Description" , [MI_EQUIP000].[MI_EQUIP000_SITE_C] "Site" , [MI_EQUIP000].MI_SITE_KEY "MI_SITE_KEY" FROM [MI_EQUIP000] WHERE [MI_EQUIP000].MI_SITE_KEY = 64262809275 OR [MI_EQUIP000].MI_ENTY_ID = 'My ID'
SELECT [MI_EQUIP000].[MI_EQUIP000_EQUIP_ID_C] "Equipment ID" , [MI_EQUIP000].[MI_EQUIP000_EQUIP_SHRT_DESC_C] "Equipment Short Description" , [MI_EQUIP000].[MI_EQUIP000_SITE_C] "Site" , [MI_EQUIP000].MI_SITE_KEY "MI_SITE_KEY" FROM [MI_EQUIP000] WHERE [MI_EQUIP000].MI_SITE_KEY = 64262809275 UNION ALL SELECT [MI_EQUIP000].[MI_EQUIP000_EQUIP_ID_C] "Equipment ID" , [MI_EQUIP000].[MI_EQUIP000_EQUIP_SHRT_DESC_C] "Equipment Short Description" , [MI_EQUIP000].[MI_EQUIP000_SITE_C] "Site" , [MI_EQUIP000].MI_SITE_KEY "MI_SITE_KEY" FROM [MI_EQUIP000] WHERE [MI_EQUIP000].MI_ENTY_ID = 'My ID'
- The Asset Hierarchy Home Parameter
- When Asset Hierarchy was created, there was no constant to represent the hierarchy home. Since the data type has changed over time and -1 is not intuitive, a new MetaSQL constant has been added. To make the queries more readable and protect you from future changes, use the new constant. (# :ahhome)Example:
SELECT [MI_EQUIP000].[MI_EQUIP000_EQUIP_ID_C] "Equipment ID" , [MI_EQUIP000].[MI_EQUIP000_EQUIP_SHRT_DESC_C] "Equipment Short Description" , [MI_EQUIP000].[MI_EQUIP000_SITE_C] "Site" , [MI_EQUIP000].ENTY_KEY "ENTY_KEY" FROM [MI_EQUIP000] WHERE (? :ah :id=ctx) = (# :ahhome) OR [MI_EQUIP000].ENTY_KEY IN (? :ah :id=ctx)
- Query Caching
- Queries are cached to improve performance. However, non-parameterized queries can slow down the performance. Therefore, consider using parameters to narrow down query results.For example, consider the following query that does not use any parameters to filter the query results:
In this case, every equip_id value creates a new query to the list of cached queries resulting in a slower performance.string sql = string.Format("SELECT MI_EQUIP000.MI_EQUIP000_SITE_C FROM MI_EQUIP000 WHERE MI_EQUIP000.MI_EQUIP000_EQUIP_ID_C = {0}", equip_id); cmd.CommandText = sql; cmd.ExecuteReader(); MetaSQL: var qrymgr = new QueryManager(); string sql = string.Format("SELECT MI_EQUIP000.MI_EQUIP000_SITE_C FROM MI_EQUIP000 WHERE MI_EQUIP000.MI_EQUIP000_EQUIP_ID_C = {0}", equip_id); var result = qrymgr.ExecuteQuerySync(sessionId, sql);
Therefore, consider rewriting the query such that 10,000 equipment records are queried in each iteration, as follows:// Build the sql string sql = "SELECT MI_EQUIP000.MI_EQUIP000_SITE_C FROM MI_EQUIP000 WHERE MI_EQUIP000.MI_EQUIP000_EQUIP_ID_C = @equip_id"; // Set up the command cmd.CommandText = sql; cmd.Parameters.Add("@equip_id", equip_id); // Execute the query var reader = cmd.ExecuteReader(); MetaSQL: var qrymgr = new QueryManager(); // Build the sql string sql = "SELECT MI_EQUIP000.MI_EQUIP000_SITE_C FROM MI_EQUIP000 WHERE MI_EQUIP000.MI_EQUIP000_EQUIP_ID_C = (? :s id=equip_id)"; // Set up the query container. QueryContainer qc = qrymgr.RetrieveQueryContainer(sessionId, sql); qc.ParmContainer.ParmDesigns[0].ParmPrompts.Add(equip_id); // Execute the query var result = qrymgr.ExecuteQuerySync(sessionId, qc);
- Parameter Size Declaration
- In addition to setting up parameters (as described in the preceding example), if you want to improve performance further, consider setting the parameter size.For example, equip_id is of the NVARCHAR data type, and hence, the size of the MIEQUIP000EQUIPIDC field is 255 characters. Therefore, you can set the size of this parameter in the query, as follows:
// Build the sql string sql = "SELECT MI_EQUIP000.MI_EQUIP000_SITE_C FROM MI_EQUIP000 WHERE MI_EQUIP000.MI_EQUIP000_EQUIP_ID_C = @equip_id"; // Build the parameter var param = cmd.CreateParameter(); param.ParameterName = "@equip_id"; param.SqlDbType = SqlDbType.NVarChar; param.Size = 255; param.Value = equip_id; // Set up the command cmd.CommandText = sql; cmd.params.add(param); // Execute the query var reader = cmd.ExecuteReader();
Note: You cannot specify the parameter size in MetaSQL.
Reduce the Number of Relationship Families
Entity families with more than 10 relationship families can slow down the loading of predecessor and successor families because of the number of joins involved in retrieving data.
select fmly_id, fmly_caption_tx, count(*) rldf_count
from MI_FAMILIES fmly
join MI_REL_DEFINITIONS rlfa on ENFA_PRED_FMLY_KEY = fmly.FMLY_KEY or ENFA_SUCC_FMLY_KEY = fmly.FMLY_KEY
group by fmly_id, fmly_caption_tx
having count(*) > 10
order by rldf_count
In addition, use a relationship definition to retrieve a relationship family. Avoid retrieving all the relationship families. Use Advanced MetaSQL Features
- Analytic Functions
- Using analytic functions, you can achieve aggregation of data over multiple groups in a single query. Example:
We support the following analytic functions:SELECT DISTINCT [MI_MRBIANAL].[MI_CRITANAL_RSK_CAT_C] "Risk Category" , Min([MI_MRBIANAL].[MI_CRITANAL_PROB_OF_FAIL_UP_C])OVER ( PARTITION BY [MI_MRBIANAL].[MI_CRITANAL_RSK_CAT_C] ) "Min Prob of Fail" , Max([MI_MRBIANAL].[MI_CRITANAL_PROB_OF_FAIL_UP_C])OVER ( PARTITION BY [MI_MRBIANAL].[MI_CRITANAL_RSK_CAT_C] ) "Max Prob of Fail" , Avg([MI_MRBIANAL].[MI_CRITANAL_INSPE_PRIOR_UP_N])OVER ( PARTITION BY [MI_MRBIANAL].[MI_CRITANAL_RSK_CAT_C] ) "Avg Insp Priority" , Count([MI_EQUIP000].ENTY_ID)OVER ( PARTITION BY [MI_MRBIANAL].[MI_CRITANAL_RSK_CAT_C] ) "# Assets" FROM {MIR_HSRBICMP} JOIN [MI_CCRBICOM] ON {MIR_HSRBICMP}.SUCC_ENTY_KEY = [MI_CCRBICOM].ENTY_KEY JOIN {MIR_HSRBICMP} Has_RBI_Components1 ON [MI_CCRBICOM].ENTY_KEY = Has_RBI_Components1.SUCC_ENTY_KEY JOIN {MIR_RBICRAN} ON [MI_CCRBICOM].ENTY_KEY = {MIR_RBICRAN}.PRED_ENTY_KEY JOIN [MI_EQUIP000] ON Has_RBI_Components1.PRED_ENTY_KEY = [MI_EQUIP000].ENTY_KEY JOIN [MI_MRBIANAL] ON {MIR_RBICRAN}.SUCC_ENTY_KEY = [MI_MRBIANAL].ENTY_KEY ORDER BY [MI_MRBIANAL].[MI_CRITANAL_RSK_CAT_C] Asc
- SUM
- MAX / MIN
- AVG
- LEAD / LAG
- COUNT
- ROW_NUMBER
- CUME_DIST
- PERCENTRANK, PERCENTILEDISC, PERCENTILE_CONT
- NTILE
- Case Statements
- Simple:
Standard:SELECT [MI_ACTION].[MI_ACTION_ID_C] "Action ID" , [MI_ACTION].[MI_ACTION_SHORT_DESC_C] "Name" , CASE YEAR([MI_ACTION].[MI_ACTION_TARGE_COMPL_DATE_CHR]) WHEN '2020' THEN 'Next Year' WHEN '2019' THEN 'This Year' WHEN '2018' THEN 'Last Year' WHEN '2017' THEN '2 Years Ago' ELSE 'Other' END "Year Due" , [MI_ACTION].[MI_ACTION_RESOURCE_COST_N] "Cost" , [MI_ACTION].[MI_ACTION_ANNUAL_COST_N] "Annual Cost" , [MI_ACTION].[MI_ACTION_SHUTDOWN_L] "Shutdown Required" , [MI_ACTION].[MI_ACTION_STATUS_C] "Status" FROM [MI_ACTION] ORDER BY [MI_ACTION].[MI_ACTION_TARGE_COMPL_DATE_CHR] Desc
SELECT [MI_ACTION].[MI_ACTION_ID_C] "Action ID" , [MI_ACTION].[MI_ACTION_SHORT_DESC_C] "Name" , CASE WHEN YEAR([MI_ACTION].[MI_ACTION_TARGE_COMPL_DATE_CHR]) = '2020' THEN 'Next Year' WHEN YEAR([MI_ACTION].[MI_ACTION_TARGE_COMPL_DATE_CHR]) = '2019' THEN 'This Year' WHEN YEAR([MI_ACTION].[MI_ACTION_TARGE_COMPL_DATE_CHR]) = '2018' THEN 'Last Year' WHEN YEAR([MI_ACTION].[MI_ACTION_TARGE_COMPL_DATE_CHR]) = '2017' THEN '2 Years Ago' ELSE 'Other' END "Year Due" , [MI_ACTION].[MI_ACTION_RESOURCE_COST_N] "Cost" , [MI_ACTION].[MI_ACTION_ANNUAL_COST_N] "Annual Cost" , [MI_ACTION].[MI_ACTION_SHUTDOWN_L] "Shutdown Required" , [MI_ACTION].[MI_ACTION_STATUS_C] "Status" FROM [MI_ACTION] ORDER BY [MI_ACTION].[MI_ACTION_TARGE_COMPL_DATE_CHR] Desc
- Correlated Subqueries
- Correlated subqueries allow you to write a child query that retrieves fields from a parent query. For more information, refer to Correlated Subqueries.