Skip to Content
0
Jul 07, 2015 at 06:40 PM

I have question about Sybase ASE 15.7 Partitioning

514 Views

Environment ASE 15.7 SP132 on Solaris 64bit with Partitions enabled.

I am trying to keep my table partitions in a separate defined segment/device and my index

partitions on that partition table in a separate defined segment/device.

My problem is that when I go to define a local index on the partitioned table, I specify a segment

that I want to contain just the indexes (partitioned indexes), but it appears that the partitioned

table and the indexes now belong to the segment/device that is created just for the indexes.

I have a partitioned table, which is partitioned by Range, based on date range. The date range is

monthly. 12 months worth of data (1 year of data in the table) is stored in one defined segment

which belongs to one physical device.

For example:

Here is my partitioned table. It's range partitioned, and each year's worth of data is stored in a

segment that is defined/created in a separate physical device.

Segment infraaudit2015seg is created in device infra_device1.

Segment infraaudit2016seg is created in device infra_device2.

Segment infraaudit2017seg is created in device infra_device3.

Segment infraaudit2018seg is created in device infra_device4.

Segment infraaudit2019seg is created in device infra_device5.

I want a year's worth of partitioned data stored in one device. Each year has it's own physical

device. Each of those devices have the the default and system segments dropped. However, there is

one device associated to the database that this table belongs to that has a default segment still

defined.

CREATE TABLE audit_event (

audit_event_id NUMERIC(19,0) identity,

audit_event_timestamp DATETIME not null,

audit_action VARCHAR(8) not null,

audit_admin VARCHAR(255) not null,

audit_organization VARCHAR(255) null,

audit_object VARCHAR(32) not null,

audit_object_id INT not null,

audit_sequence TINYINT not null,

audit_column_name VARCHAR(125) not null,

column_old_value UNIVARCHAR(2000) null,

column_new_value UNIVARCHAR(2000) null,

audit_identity UNIVARCHAR(512) not null)

lock datarows

PARTITION BY RANGE (audit_event_timestamp) (

event_M62015 values <= ("Jun 30 2015 11:59:59:999PM") on infraaudit2015seg,

event_M72015 values <= ("Jul 31 2015 11:59:59:999PM") on infraaudit2015seg,

event_M82015 values <= ("Aug 31 2015 11:59:59:999PM") on infraaudit2015seg,

event_M92015 values <= ("Sep 30 2015 11:59:59:999PM") on infraaudit2015seg,

event_M102015 values <= ("Oct 31 2015 11:59:59:999PM") on infraaudit2015seg,

event_M112015 values <= ("Nov 30 2015 11:59:59:999PM") on infraaudit2015seg,

event_M122015 values <= ("Dec 31 2015 11:59:59:999PM") on infraaudit2015seg,

event_M12016 values <= ("Jan 31 2016 11:59:59:999PM") on infraaudit2016seg,

event_M22016 values <= ("Feb 29 2016 11:59:59:999PM") on infraaudit2016seg,

event_M32016 values <= ("Mar 31 2016 11:59:59:999PM") on infraaudit2016seg,

event_M42016 values <= ("Apr 30 2016 11:59:59:999PM") on infraaudit2016seg,

event_M52016 values <= ("May 31 2016 11:59:59:999PM") on infraaudit2016seg,

event_M62016 values <= ("Jun 30 2016 11:59:59:999PM") on infraaudit2016seg,

event_M72016 values <= ("Jul 31 2016 11:59:59:999PM") on infraaudit2016seg,

event_M82016 values <= ("Aug 31 2016 11:59:59:999PM") on infraaudit2016seg,

event_M92016 values <= ("Sep 30 2016 11:59:59:999PM") on infraaudit2016seg,

event_M102016 values <= ("Oct 31 2016 11:59:59:999PM") on infraaudit2016seg,

event_M112016 values <= ("Nov 30 2016 11:59:59:999PM") on infraaudit2016seg,

event_M122016 values <= ("Dec 31 2016 11:59:59:999PM") on infraaudit2016seg,

event_M12017 values <= ("Jan 31 2017 11:59:59:999PM") on infraaudit2017seg,

event_M22017 values <= ("Feb 28 2017 11:59:59:999PM") on infraaudit2017seg,

event_M32017 values <= ("Mar 31 2017 11:59:59:999PM") on infraaudit2017seg,

event_M42017 values <= ("Apr 30 2017 11:59:59:999PM") on infraaudit2017seg,

event_M52017 values <= ("May 31 2017 11:59:59:999PM") on infraaudit2017seg,

event_M62017 values <= ("Jun 30 2017 11:59:59:999PM") on infraaudit2017seg,

event_M72017 values <= ("Jul 31 2017 11:59:59:999PM") on infraaudit2017seg,

event_M82017 values <= ("Aug 31 2017 11:59:59:999PM") on infraaudit2017seg,

event_M92017 values <= ("Sep 30 2017 11:59:59:999PM") on infraaudit2017seg,

event_M102017 values <= ("Oct 31 2017 11:59:59:999PM") on infraaudit2017seg,

event_M112017 values <= ("Nov 30 2017 11:59:59:999PM") on infraaudit2017seg,

event_M122017 values <= ("Dec 31 2017 11:59:59:999PM") on infraaudit2017seg,

event_M12018 values <= ("Jan 31 2018 11:59:59:999PM") on infraaudit2018seg,

event_M22018 values <= ("Feb 28 2018 11:59:59:999PM") on infraaudit2018seg,

event_M32018 values <= ("Mar 31 2018 11:59:59:999PM") on infraaudit2018seg,

event_M42018 values <= ("Apr 30 2018 11:59:59:999PM") on infraaudit2018seg,

event_M52018 values <= ("May 31 2018 11:59:59:999PM") on infraaudit2018seg,

event_M62018 values <= ("Jun 30 2018 11:59:59:999PM") on infraaudit2018seg,

event_M72018 values <= ("Jul 31 2018 11:59:59:999PM") on infraaudit2018seg,

event_M82018 values <= ("Aug 31 2018 11:59:59:999PM") on infraaudit2018seg,

event_M92018 values <= ("Sep 30 2018 11:59:59:999PM") on infraaudit2018seg,

event_M102018 values <= ("Oct 31 2018 11:59:59:999PM") on infraaudit2018seg,

event_M112018 values <= ("Nov 30 2018 11:59:59:999PM") on infraaudit2018seg,

event_M122018 values <= ("Dec 31 2018 11:59:59:999PM") on infraaudit2018seg,

event_M12019 values <= ("Jan 31 2019 11:59:59:999PM") on infraaudit2019seg,

event_M22019 values <= ("Feb 28 2019 11:59:59:999PM") on infraaudit2019seg,

event_M32019 values <= ("Mar 31 2019 11:59:59:999PM") on infraaudit2019seg,

event_M42019 values <= ("Apr 30 2019 11:59:59:999PM") on infraaudit2019seg,

event_M52019 values <= ("May 31 2019 11:59:59:999PM") on infraaudit2019seg,

event_M62019 values <= ("Jun 30 2019 11:59:59:999PM") on infraaudit2019seg,

event_M72019 values <= ("Jul 31 2019 11:59:59:999PM") on infraaudit2019seg,

event_M82019 values <= ("Aug 31 2019 11:59:59:999PM") on infraaudit2019seg,

event_M92019 values <= ("Sep 30 2019 11:59:59:999PM") on infraaudit2019seg,

event_M102019 values <= ("Oct 31 2019 11:59:59:999PM") on infraaudit2019seg,

event_M112019 values <= ("Nov 30 2019 11:59:59:999PM") on infraaudit2019seg,

event_M122019 values <= ("Dec 31 2019 11:59:59:999PM") on infraaudit2019seg

)

GO

I want to define local indexes on the audit_event partition table, such that the indexes pick up

the same partitioning scheme. When I create the indexes using just the word local, example:

CREATE nonclustered index idx2_audit_event

ON audit_event(audit_event_timestamp, audit_sequence, audit_organization, audit_object,

audit_column_name, LOWER(audit_identity)) local index

GO

Then, the index and all of the partitions are associated to the default segment. The audit_event

partitions no longer belong to the infraauditYYYYseg segments that I created. I do not want this.

If I create a new device called partition_indexes, and drop the default and system segments from

that device, and create a new segment in that device called index_infraseg, and then try to create

the index using this syntax:

CREATE nonclustered index idx2_audit_event

ON audit_event(audit_event_timestamp, audit_sequence, audit_organization, audit_object,

audit_column_name, LOWER(audit_identity)) on index_infraseg local index idx2ae on index_infraseg

GO

Then the index appears to be part of the index_infraseg, but then so do all of the partitions. The

partitions no longer belong to the infraauditYYYYseg segments, and now belong to the index_infraseg

segment.

How can I keep my audit_event partitions in separate segments/devices from the indexes which I want

in the index_infraseg segment/parition_index device?

Thanks

Lisa Sayre