Can we use TTL on CQLSSTableWriter? like columnFamilyWriter.addExpiringColumn. (http://shareitexploreit.blogspot.in/2012/02/cassandra-bulk-loader.html)
Yes you can . Moreover , the CQLSSTableWriter you have been using is upgraded. Try using the latest one.
http://cassandrabee.blogspot.in/2014/04/cqlsstablewriter-bulk-loading-in.html
How to use the TTL
Just add the "USING TTL ?" to the insert query and bind the value to it.
Related
Used HybridRelations to store user notifications in mongoDB instead of mysql and imported 3million records and now user->notifications()->take(5)->get() or user->notifications()->paginate(5) takes over 30 seconds.
any idea how to speed it up?
on mysql with same amount of records it took 200 milliseconds.
notificaiton model has user_id and description and priority and read flag and user_id is set as an index.
Maybe this suggestion can help you.
When use user->notifications() means the query like that
db.notificaiton.find( {"user_id": <?> } )
That will get all record by user_id.
You can dump the user->notifications() and check. That should be Collection type and contains more than 5 records.
The solution is this.
You can write specific method to ensure what your mongo query expression.
The problem was the column that you are sorting by should be an index as well as the columns you use where clause on.
when I use <engine> tag to set ttl for query_log table in config.xml file - ttl is set for new table query_log after removing old one:
<query_log>
<database>system</database>
<table>query_log</table>
<engine>ENGINE = MergeTree PARTITION BY toYYYYMM(event_date)
ORDER BY (event_date, event_time)
TTL event_date + INTERVAL 1 MINUTE DELETE
SETTINGS min_bytes_for_wide_part = '10M'
</engine>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_log>
but when I want to configure ttl in a separate tag <ttl> - ttl doesn't set for new query_log table:
<query_log>
<database>system</database>
<table>query_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<ttl>event_date + INTERVAL 1 MINUTE DELETE</ttl>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_log>
I use clickhouse 20.8.2.3
Can someone help me to solve this problem, please? I want to use <ttl> option
20.8.2.3 is out support.
You need to upgrade.
https://github.com/ClickHouse/ClickHouse/blob/master/CHANGELOG.md#clickhouse-release-v211215-stable-2021-01-18
ClickHouse release v21.1.2.15-stable 2021-01-18
Allow specifying TTL to remove old entries from system log tables, using the <ttl> attribute in config.xml. #17438 (Du Chuan).
I have an application on Java Spring that uses Redis fore some caching. Is there a way how to get a key or key-value pair that was added to the Redis last?
I have also 3 different types of values (Entities) that are stored to the Redis. Is there a way how get the latest record of one exact type of "value"?
Is Redis even suitable for such kind of things?
No Redis doesn't have this built-in functionality. You need to do it manually.
Whenever you set a key, you need to set that key name to an another key such as latest:key
set entity:1 value:1
set latest:key entity:1
get latest:key
You may also use hash to set the latest's key as field and value as hash value.
hset latest:key entity:1 value:1
hgetall latest:key
I wanted to be able to set timezone in each query depending on my user's preferred timezone without adding timezone conversion in each raw sql generated by my application.
I was able to query/retrieve the records in 'Asia/Manila' TZ using this config
Sequel.extension :named_timezones
Sequel.application_timezone = 'Asia/Manila'
Is it possible to set application_timezone per query so that I will pass the current application user's timezone in each request.
You probably want to use Sequel's thread_local_timezones extension: http://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/thread_local_timezones_rb.html
This is per thread, not per query, but should hopefully still work for your needs.
Store everything in UTC and then convert in the UI/presentation layer.
I use Rails.cache.fetch(method_name, :expires_in => 15.minutes) to cache the data. When i update a column, the updated column is displayed in the page only after 15 mins. Is there a way i can clear the cache of the updated record only?
You can clear the entire cache using Rails.cache.clear.
To clear a single entry, use Rails.cache.delete(method_name).