How to configure table with time-to-live (TTL) enabled
                    
                
                
                    
                        book
                        
Article ID: KB0075553
                        
                    
                    
                        calendar_today
                        
Updated On: 
                    
                 
                
                
                
                    
                
                    
                    
                    
                    
                        
                            
Description
                        
                        
                            TTL enabled to remove rows from a table after a specific time.
 
                         
                     
                    
                    
                        
                            
                                
Environment
                            
                            
                                All Operating Systems
                            
                         
                        
                    
                    
                        
                            
                                
Resolution
                            
                            
                                To enable TTL it is required to create the table with a default_ttl value greater than 0.
The default_ttl value is the time in seconds a row should be available in a table.
Once ttl reached for a row, the row deleted by a scan thread.
By default, tables scanned once every hour for expired rows.
The frequency of the scan can be modified with table  property “expiration_scan_period”.
e.g.: (check every 5 secs for expired rows, rows expire after 1000secs):
table create default_ttl=1000 expiration_scan_period=5 <tablename> <primaryKey(s) and type>
Note:
When a default_ttl was not set for a table, ttl is not enabled.
A client can still execute the method row.setTTL(), but the server not set the ttl value (value ignored). In current versions (4.2.0 and older) no error/warning reported (CR FFY-3093).
 
                            
                         
                        
                    
                        
                            
                                
Issue/Introduction
                            
                            
                                How to configure table with time-to-live (TTL) enabled
                            
                         
                        
                    
                        
                            
                                
Additional Information
                            
                            
                                time-to-live, ttl
                            
                         
                        
                    
                    
                
                    
                        
                            Was this article helpful?
                        
                        
                            
                                thumb_up
                                Yes
                            
                            
                                thumb_down
                                No