Vladimir Ozerov created IGNITE-7948:
---------------------------------------

             Summary: SQL: read only necessary fields into the row when possible
                 Key: IGNITE-7948
                 URL: https://issues.apache.org/jira/browse/IGNITE-7948
             Project: Ignite
          Issue Type: Task
          Components: sql
            Reporter: Vladimir Ozerov
            Assignee: Vladimir Ozerov


When H2 row is read, we always fill it with data eagerly through link 
materialization. Materialization is performed under page "read lock" what 
guarantees row-level consistency. This may lead to excessive memory pressure 
due to memory copying. For example, consider a class with 50 fields and a query 
which reads only 2 of them. 48 other fields will be copied without a reason. 
Lazy initialization is not an option because it will only defer memcpy, but not 
eliminate it. 

Instead we can try using H2. It passes {{TableFilter}} class to some of index 
access methods*. We can analyze this class and create the list of required 
fields. Then we can read these fields under read lock from offheap and put them 
to the row.

In addition to saved memcpy this could give us more benefits:
1) No more need for field cache ({{GridH2KeyValueRowOnheap#valCache}})
2) No more need to read {{_VER}} column and possibly {{_KEY}} or {{_VAL}}

But there are a number of drawbacks as well. E.g. it is impossible to read 
strings from offheap efficiently, so queries with VARCHAR will definitely 
suffer from this change.

\* {{org.h2.index.Index#find(org.h2.table.TableFilter, org.h2.result.SearchRow, 
org.h2.result.SearchRow)}}



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

Reply via email to