OCLps Example
No edit summary
No edit summary
Tag: 2017 source edit
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:


There are different approaches to improving the performance of a comment section in an article. These include selecting the article based on the self and the first comment, using the PSEval value to calculate the number of comments that are liked, and combining OCLPS and PSEval with OCL. Each approach has a different impact on performance.   
In this example, we look at a small model that stores articles with comments made by users. There may be a lot of comments on the article and below is a description of how to efficiently find "my" comments. "My" refers to the logged-in user.   


One of these methods is through the use of PSEval values. PSEval provides a way to select and manipulate data in the database without loading it into memory. We will explore how to use PSEval to improve the database storage performance. 
There are different approaches to improving the performance of retrieving the comment section for an article. These include selecting the article based on the self and the first comment, using the PSEval value to calculate the number of liked comments, and combining PSEval with OCL.   
 
One of these methods is through the use of PSEvalValue. PSEvalValue provides a way to select and manipulate data in the database without loading it into memory.  


To illustrate how PSEval works, let's consider a small model that involves three tables: Article, SysUser, and Comment.  
To illustrate how PSEval works, let's consider a small model that involves three tables: Article, SysUser, and Comment.  
Line 8: Line 10:
[[File:OCLps_Example_Image.png|frameless|397x397px]]  
[[File:OCLps_Example_Image.png|frameless|397x397px]]  


A link role name allows for navigation from SysUser to Comment and vice versa. This model assumes that a SysUser won't have excessive comments.   
The link role allows for navigation from SysUser to Comment and vice versa. This model assumes that a single SysUser won't have excessive comments.   


Suppose we want to display the number of likes that an article has received. One way to do this is to load every comment object into memory, filter out the ones that have a "like", and then count how many there are. However, this would be inefficient for articles with numerous comments. A better way is to use PSEval to select only the comments that have a "like" and count them without loading them into memory.   
Suppose we want to display the number of likes that an article has received. One way to do this is to load every comment object into memory, filter out the ones that have a "like" and then count how many there are. However, this would be inefficient for articles with several comments. A better way is to use PSEvalValue to select only the comments that have a "like" and count them without loading them into memory.   


However, using PSEval has its limitations. If a user likes or unlikes a comment, the like count in the user interface will not update because nothing is triggering a re-evaluation of the data. One way to work around this is to use PSEval to get all the comments for an article but only the ones that have a "like" on them. This method still loads objects but it only loads the ones with a "like" which can improve performance. PSEval can make querying large datasets much faster and more efficient.  
However, using PSEvalValue has its limitations. If a user likes or unlikes a comment, the "like" count in the user interface will not update because nothing is triggering a re-evaluation of the data. One way to work around this is to use PSEval to get all the comments for an article but only the ones that have a "like" on them. This method still loads objects, but it only loads the ones with a "like" which can improve performance. PSEval can make querying large datasets much faster and more efficient.  
 
=== Watch the Video to Learn More ===


=== Learn More in This Video ===
<html>
<html>
<br>
<div class="video">
<div class="video">
   <div class="video__wrapper">
   <div class="video__wrapper">
     <iframe src="https://www.youtube.com/embed/nkPR9P4i3P0" title="YouTube video player" frameborder="0" allowfullscreen></iframe>
     <iframe src="https://www.youtube.com/embed/pAaB3IGr6mI?si=ui3HnMMuVGwLdMCW" title="YouTube video player" frameborder="0" allowfullscreen></iframe>
   </div>
   </div>
</div>


</html>


</html>
[[Category:OCLPS]]
{{Edited|July|12|2024}}

Latest revision as of 05:43, 12 March 2024

In this example, we look at a small model that stores articles with comments made by users. There may be a lot of comments on the article and below is a description of how to efficiently find "my" comments. "My" refers to the logged-in user.

There are different approaches to improving the performance of retrieving the comment section for an article. These include selecting the article based on the self and the first comment, using the PSEval value to calculate the number of liked comments, and combining PSEval with OCL.

One of these methods is through the use of PSEvalValue. PSEvalValue provides a way to select and manipulate data in the database without loading it into memory.

To illustrate how PSEval works, let's consider a small model that involves three tables: Article, SysUser, and Comment.

OCLps Example Image.png

The link role allows for navigation from SysUser to Comment and vice versa. This model assumes that a single SysUser won't have excessive comments.

Suppose we want to display the number of likes that an article has received. One way to do this is to load every comment object into memory, filter out the ones that have a "like" and then count how many there are. However, this would be inefficient for articles with several comments. A better way is to use PSEvalValue to select only the comments that have a "like" and count them without loading them into memory.

However, using PSEvalValue has its limitations. If a user likes or unlikes a comment, the "like" count in the user interface will not update because nothing is triggering a re-evaluation of the data. One way to work around this is to use PSEval to get all the comments for an article but only the ones that have a "like" on them. This method still loads objects, but it only loads the ones with a "like" which can improve performance. PSEval can make querying large datasets much faster and more efficient.

Learn More in This Video

This page was edited 67 days ago on 03/12/2024. What links here