Jump to content

Statistics in rv_data_bkt_m being replaced by next hour


Recommended Posts

Hello, I am new to Revive and I am probably doing something terribly wrong.

I had Revive in a very old server and I needed to transfer it to a new server, with updated php, database and revive version. So I decided to manually copy only the revive data, but excluding configuration data. Everything is working well, except by the statistics.

All the statistics from before the export are working fine. But after that date, the new statistics are not showing up.

Querying `SELECT * FROM rv_data_bkt_m order by interval_start desc` I noticed that when new-hour-statistics are inserted, the hour-before-statistics are deleted. For example, when interval_start is "2020-05-19 11:00:00", all data with "2020-05-19 10:00:00" is deleted from that table. Is that correct?

Thank you,

Matheus

Link to comment
Share on other sites

Hi, I solved my problem. As I migrated the data by myself, the id sequence (postgres) were out of sync. So, when trying to write in rv_data_summary_ad_hourly, it was trying to write to an ID that already exists. To fix that, I set the rv_data_summary_ad_hourly_data_summary_ad_hourly_id_seq manually:

 

BEGIN;
-- protect against concurrent inserts while you update the counter
LOCK TABLE rv_data_summary_ad_hourly IN EXCLUSIVE MODE;
-- Update the sequence
SELECT setval(
    'rv_data_summary_ad_hourly_data_summary_ad_hourly_id_seq', 
    COALESCE((SELECT MAX(data_summary_ad_hourly_id)+1 FROM rv_data_summary_ad_hourly), 1), 
    false
);
COMMIT;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...