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

Vladimir Ozerov commented on IGNITE-7687:
-----------------------------------------

[~slukyanov],
SQL accesses data in a very different way comparing to normal cache API. In 
fact, SQL queries do not instantiate GridCacheMapEntry and hence do not have 
direct access to eviction info. Moreover, consider {{SELECT (*) FROM 
someTable}} case. In this case we would have to update *all* entries on every 
read, what would incur massive performance drop. 

That said, we are not going to integrate TTL support into SQL, as it is too 
expensive and impractical.

> SQL SELECT doesn't update TTL for Touched/AccessedExpiryPolicy
> --------------------------------------------------------------
>
>                 Key: IGNITE-7687
>                 URL: https://issues.apache.org/jira/browse/IGNITE-7687
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.5
>            Reporter: Stanislav Lukyanov
>            Priority: Major
>
> SQL SELECT queries don't update TTLs when TouchedExpiryPolicy or 
> AccessedExpiryPolicy is used (unlike IgniteCache::get which does update the 
> TTLs).
> Example (modified SqlDmlExample):
> ========================
>     CacheConfiguration<Long, Organization> orgCacheCfg = new 
> CacheConfiguration<Long, Organization>(ORG_CACHE)
>         .setIndexedTypes(Long.class, Organization.class)
>         .setExpiryPolicyFactory(TouchedExpiryPolicy.factoryOf(new 
> Duration(TimeUnit.SECONDS, 10)));
>     
>     IgniteCache<Long, Organization> orgCache = 
> ignite.getOrCreateCache(orgCacheCfg);
>     
>     SqlFieldsQuery qry = new SqlFieldsQuery("insert into Organization (_key, 
> id, name) values (?, ?, ?)");
>     orgCache.query(qry.setArgs(1L, 1L, "ASF"));
>     orgCache.query(qry.setArgs(2L, 2L, "Eclipse"));
>     
>     SqlFieldsQuery qry1 = new SqlFieldsQuery("select id, name from 
> Organization as o");
>     for (int i = 0; ;i++) {
>         List<List<?>> res = orgCache.query(qry1).getAll();
>         print("i = " + i);
>         for (Object next : res)
>             System.out.println(">>>     " + next);
>         U.sleep(5000);
>     }
> ========================
> Output:
> >>> i = 0
> >>>     [1, ASF]
> >>>     [2, Eclipse]
> >>> i = 1
> >>>     [1, ASF]
> >>>     [2, Eclipse]
> >>> i = 2
> >>> i = 3
> ...



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

Reply via email to