I am working on understanding the SQLA 16/17 system tables and I'm a bit stuck on where to find index FOR OLAP WORKLOAD.
I was able to find a reference to SYSPHYSIDX max_key_distance but am unable to figure this out.
Here is what I have so far if anyone is interested
SELECT ForeignKeys.foreign_table_id AS TableId,
SQL.SmartQuote( ForeignTables.table_name ) AS FTableName,
SQL.SmartQuote( UPPER( ForeignOwners.user_name ) ) AS FTableOwner,
SQL.SmartQuote( PrimaryTables.table_name ) AS PTableName,
SQL.SmartQuote( UPPER( PrimaryOwners.user_name ) ) AS PTableOwner,
SQL.FKIndexColumns(
ForeignKeys.foreign_table_id,
ForeignKeys.foreign_index_id,
1 ) AS FIndexList,
SQL.FKIndexColumns(
ForeignKeys.primary_table_id,
ForeignKeys.primary_index_id,
0 ) AS PIndexList,
IF ForeignTables.clustered_index_id =
ForeignKeys.foreign_index_id THEN 'CLUSTERED'
ELSE NULL
ENDIF AS ClusteredIndex,
CASE ForeignKeys.check_on_commit
WHEN 'Y' THEN 'CHECK ON COMMIT'
ELSE NULL
END AS CheckOnCommit,
CASE ForeignKeys.nulls
WHEN 'N' THEN 'NOT NULL'
ELSE NULL
END AS AllowNull,
CASE ForeignKeys.match_type
WHEN 1 THEN 'MATCH SIMPLE'
WHEN 2 THEN 'MATCH FULL'
WHEN 1 THEN 'MATCH UNIQUE SIMPLE'
WHEN 1 THEN 'MATCH UNIQUE FULL'
ELSE NULL
END AS MatchType,
CASE FKDeleteAction.referential_action
WHEN 'C' THEN 'CASCADE'
WHEN 'D' THEN 'DELETE'
WHEN 'N' THEN 'SET NULL'
WHEN 'R' THEN 'RESTRICT'
ELSE 'RESTRICT'
END AS ONDeleteAction,
CASE FKUpdateAction.referential_action
WHEN 'C' THEN 'CASCADE'
WHEN 'D' THEN 'DELETE'
WHEN 'N' THEN 'SET NULL'
WHEN 'R' THEN 'RESTRICT'
ELSE 'RESTRICT'
END AS ONUpdateAction,
FTConstraint.constraint_name AS ConstraintName,
SQL.ForeignKey( FTableOwner,
FTableName,
AllowNull,
ConstraintName,
FIndexList,
PTableOwner,
PTableName,
PIndexList,
MatchType,
CheckOnCommit,
ClusteredIndex,
ONDeleteAction,
ONUpdateAction) AS SQL
FROM SYS.SysFKey AS ForeignKeys
JOIN SYS.SysIdx AS FKIndex ON ( ForeignKeys.foreign_table_id = FKIndex.table_id AND ForeignKeys.foreign_index_id = FKIndex.index_id )
LEFT OUTER
JOIN SYS.SysTrigger AS FKDeleteAction ON ( FKIndex.table_id = FKDeleteAction.foreign_table_id AND FKIndex.index_id = FKDeleteAction.foreign_key_id AND FKDeleteAction.event = 'D')
LEFT OUTER
JOIN SYS.SysTrigger AS FKUpdateAction ON ( FKIndex.table_id = FKUpdateAction.foreign_table_id AND FKIndex.index_id = FKUpdateAction.foreign_key_id AND FKUpdateAction.event = 'C')
JOIN SYS.SysTab AS ForeignTables ON ( ForeignKeys.foreign_table_id = ForeignTables.table_Id )
JOIN SYS.SysConstraint AS FTConstraint ON ( ForeignTables.object_id = FTConstraint.table_object_id AND FTConstraint.constraint_type = 'F' AND FKIndex.object_id = FTConstraint.ref_object_id )
JOIN SYS.SysUser AS ForeignOwners ON ( ForeignTables.creator = ForeignOwners.user_id )
JOIN SYS.SysTab AS PrimaryTables ON ( ForeignKeys.primary_table_id = PrimaryTables.table_Id )
JOIN SYS.SysUser AS PrimaryOwners ON ( PrimaryTables.creator = PrimaryOwners.user_id )
Request clarification before answering.
PowerDesigner can nicely reverse engineer the entire DB from an ODBC connection.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.