Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: Question on create clustered index on non-primary key columns

$
0
0

> Suppose I have a table mytab with single column primary key, say mytab(id,  col1, col2, col3...)

> then I want to best performance for insert like

> insert into mytab(id,  col1, col2, col3...)

> values (.....)

 

Best Performance depends on a lot of factors. How many rows are you inserting at a time ?

How many simultaneous inserts ?

Is you id sequentially increasing ?

What performance do you want for getting at your data ?

Are you using datapages, datarows, allpages locking ?

 

Here are the basics.

1) clustered indexes will generally be slower for inserts/deletes than non-clustered indexes as you can end up with page splits (on inserts) and page merges (on deletes). However, if the index is wide then the non-clustered index will contain a lot of data and be slower.

2) Never create a non-unique clustered index - you'll get overflow pages which are hideously slow (well they were in version 11)

3) clustered indexes can reduce contention if you're inserting simultaneously.

4) How are you getting data out of the database.

 

The best thing to do is test. Be careful if you're using a SAN - performance can vary according to other applications on the SAN.


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>