K
K
ksvdon2014-11-27 15:20:05
SQLite
ksvdon, 2014-11-27 15:20:05

How to reduce the number of records in the database?

It is necessary to limit the number of records in the database per day. Those. There is already a READY DB in it there is too much data, which interferes with the check. How to truncate this database so that the records for each date (timestamp) (per day) are, say, 100 pieces. Let's say from each date to take from the most recent value (DESC). Count 100 values ​​and delete the rest of the tabular data "until the next day". As a result, the client program, accessing the database, selecting values ​​for 5 days, will display no more than 500 values. 100 per day. How to do it? DB in SQLite

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2014-11-28
@SashaSkot

delete * from tablename where timstamp > (select timestamp from tablename order by timestamp desc limit 100)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question