Hi,
The queries running against views are taking time to execute when CDC is enabled(i.e. Delete/Update/Merge operation for the underlying tables). But Vertica is not allowing to use 'AT EPOCH LATEST' inside VIEW Definition as below:
CREATE OR REPLACE VIEW ACCOUNT_view AS AT EPOCH LATEST SELECT
Is there an alternative for this?
Thanks,
Saritha
Usage of AT EPOCH LATEST in VIEW
Moderator: NorbertKrupa
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: Usage of AT EPOCH LATEST in VIEW
Hi,
I think you have to create the view, and then query it at a certain epoch.
Example:
I think you have to create the view, and then query it at a certain epoch.
Example:
Code: Select all
dbadmin=> select * from epochs;
epoch_close_time | epoch_number
-------------------------------+--------------
2016-02-17 09:41:40.093701-05 | 22
2016-02-17 09:46:55.158934-05 | 23
2016-02-17 09:47:26.71037-05 | 24
(3 rows)
dbadmin=> create table temp (c int);
CREATE TABLE
dbadmin=> insert into temp values (1);
OUTPUT
--------
1
(1 row)
dbadmin=> commit;
COMMIT
dbadmin=> select * from epochs;
epoch_close_time | epoch_number
------------------------------+--------------
2016-02-17 09:47:26.71037-05 | 24
2016-02-17 09:49:35.69914-05 | 25
(2 rows)
dbadmin=> insert into temp values (2);
OUTPUT
--------
1
(1 row)
dbadmin=> select * from temp;
c
---
1
2
(2 rows)
dbadmin=> at epoch 25 select * from temp;
c
---
1
(1 row)
dbadmin=> create view temp_vw as select * from temp;
CREATE VIEW
dbadmin=> at epoch 25 select * from temp_vw;
c
---
1
(1 row)
dbadmin=> select * from temp_vw;
c
---
1
2
(2 rows)
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
-
- GURU
- Posts: 527
- Joined: Tue Oct 22, 2013 9:36 pm
- Location: Chicago, IL
- Contact:
Re: Usage of AT EPOCH LATEST in VIEW
You could also just build a view based on the actual epoch in the table (i.e. SELECT epoch, id FROM public.customers;).
Checkout vertica.tips for more Vertica resources.
Re: Usage of AT EPOCH LATEST in VIEW
Saritha,
Are your performance issues with CDC enabled because your queries are queueing on the table locks? Normally queries executed in transaction mode READ COMMITTED, which is equivalent to AT EPOCH LATEST. If your queries are queueing on the locks, that suggests that your queries are running in SERIALIZABLE mode. If that’s true - is there a good reason for it? You could just switch them to READ COMMITTED.
—Sharon
Are your performance issues with CDC enabled because your queries are queueing on the table locks? Normally queries executed in transaction mode READ COMMITTED, which is equivalent to AT EPOCH LATEST. If your queries are queueing on the locks, that suggests that your queries are running in SERIALIZABLE mode. If that’s true - is there a good reason for it? You could just switch them to READ COMMITTED.
—Sharon
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC
Vertica Consultant, Zazz Technologies LLC
Re: Usage of AT EPOCH LATEST in VIEW
dbadmin=> SHOW TRANSACTION_ISOLATION;
name | setting
-----------------------+----------------
transaction_isolation | READ COMMITTED
The transaction isolation level is already READ_COMMITTED.
name | setting
-----------------------+----------------
transaction_isolation | READ COMMITTED
The transaction isolation level is already READ_COMMITTED.
Re: Usage of AT EPOCH LATEST in VIEW
So then AT EPOCH LATEST is already effectively in use with READ COMMITTED - no need to use that. It would be worth understanding the actual source of the slowdown when you have the CDC running. Using AT EPOCH LATEST isn’t the solution.
—Sharon
—Sharon
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC
Vertica Consultant, Zazz Technologies LLC
Re: Usage of AT EPOCH LATEST in VIEW
Cool topic. I'm sorry to interrupt the flow of this thread, but can someone explain what CDC is?The queries running against views are taking time to execute when CDC is enabled...
Thanks,
Juliette
Juliette