You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicecomb.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/08/09 16:44:00 UTC

[jira] [Commented] (SCB-829) An index on TxEvent (globalTxId) should be added

    [ https://issues.apache.org/jira/browse/SCB-829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16575114#comment-16575114 ] 

ASF GitHub Bot commented on SCB-829:
------------------------------------

oliugian opened a new pull request #246: SCB-829 An index on TxEvent (globalTxId) should be added
URL: https://github.com/apache/incubator-servicecomb-saga/pull/246
 
 
   
   https://issues.apache.org/jira/browse/SCB-829
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> An index on TxEvent (globalTxId) should be added
> ------------------------------------------------
>
>                 Key: SCB-829
>                 URL: https://issues.apache.org/jira/browse/SCB-829
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Saga
>    Affects Versions: saga-0.3.0
>         Environment: postgres and mysql
>            Reporter: FuChenGeng
>            Priority: Minor
>              Labels: easyfix
>             Fix For: saga-0.3.0
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> When the amount of data in the TxEvent table is large, the select SQL statement of method(
> findByEventGlobalTxIdAndEventType
> )  is executed very slowly. Here, an index on globalTxId should be added.
>  
> Here is the SQL statement. it will be executed 3 times in a transaction with 2 subtransactions.
> @Query("SELECT DISTINCT new org.apache.servicecomb.saga.alpha.core.TxEvent("
>  + "t.serviceName, t.instanceId, t.globalTxId, t.localTxId, t.parentTxId, "
>  + "t.type, t.compensationMethod, t.payloads "
>  + ") FROM TxEvent t "
>  + "WHERE t.globalTxId = ?1 AND t.type = ?2 "
>  + " AND ( SELECT MIN(t1.retries) FROM TxEvent t1 "
>  + " WHERE t1.globalTxId = t.globalTxId "
>  + " AND t1.localTxId = t.localTxId "
>  + " AND t1.type IN ('TxStartedEvent', 'SagaStartedEvent') ) = 0 ")
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)