goldengate keycols

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

goldengate keycols

Roshan
OGG 18.1.0
Hello Erman,

can you please advise why GG will perform Full Table Scan for a table which does not have any KEYCOLS? Why when KEYCOLS is set not FS is done?
https://www.ateam-oracle.com/oracle-goldengate-tables-without-keys

Thanks,

Roshan
Reply | Threaded
Open this post in threaded view
|

Re: goldengate keycols

ErmanArslansOracleBlog
Administrator
Without the availability of a key or KEYCOLS clause, Replicat uses all columns of the table to build its WHERE clause, essentially performing a full table scan.

Also note that,

If a target table does not have a primary key, unique key,  a unique index, Replicat does a full scan..

You use a KEYCOLS in the TABLE and MAP statements to make Replicat use the specified columns as a key. This is where you actually prevent full table scans in the absence of keys..
Reply | Threaded
Open this post in threaded view
|

Re: goldengate keycols

ErmanArslansOracleBlog
Administrator
So -> "Replicat uses all columns of the table "
Reply | Threaded
Open this post in threaded view
|

Re: goldengate keycols

Roshan
Thanks for the update.

Can I include a column which contains null in my set of columns which I define as keycols? Normally PKs do not contain nulls.

Reply | Threaded
Open this post in threaded view
|

Re: goldengate keycols

Roshan
All columns which I select in my environment contain nulls in most tables.
Reply | Threaded
Open this post in threaded view
|

Re: goldengate keycols

ErmanArslansOracleBlog
Administrator
Keycols designates columns that uniquely identify rows. So there is no point to include null columns in the column list.. I didn't test it but I think keycols will not help you in the case of having a list of null columns in the definition.
So what is the problem here? You have a table with lots of nulls. So what are going to do with it? Don't you have some not null columns, which may be used to identify the rows? Just put them in keycols and go ahead.
How much big is the table? If it is not so big, and if a full table scan doesn't take much time, then you may live with it.. Of course if the table is getting bigger and bigger everyday, then you need to think something for the future.. But in that case, you may change the database design.. You may think decomposing those always-null columns from the not-null columns and etc..