更新json列花费太多时间

时间:2019-08-23 12:32:21

标签: json sql-server tsql spring-data-jpa

我正在使用mssql,在第一栏中,我将所有内容都保留为json字符串。它具有多个嵌套数组。

当我想通过其ID更新json列时,花费了超过4秒钟的时间,我正在使用spring data jpa。

@Service

public void updateFeed(Feed feed, String customerId) throws IOException {

    StopWatch stop = new StopWatch();

    String custttString = customerRepository.getCustomer(customerId);

        // some manipulations

    stop.start();
    customerRepository.updateCustomerWithFeed(custJson,customerId);
    stop.stop();
    System.out.println(stop.getTotalTimeMillis());

}

@Repository

@Modifying
@Query(value="update Customers set configJSON = ?1 where CustomerId = ?2", nativeQuery= true)
@Transactional
void updateCustomerWithFeed(String custJson, String custId);

这需要4秒钟以上,太长了。

任何帮助,为什么要花这么长时间?

0 个答案:

没有答案