我在Azure Sql中有内存表,其中插入的大量数据可能达到7000 /秒,到目前为止它消耗高达90%的高CPU。任何人都可以解释为什么以及如何改进它?
public class DetailActvityActionBtn implements View.OnClickListener {
private Activity activity;
public DetailActvityActionBtn(Activity activity){
this.activity = activity;
}
@Override
public void onClick(View view){
//You can now call activity.finish() to close the calling activity...
activity.finish();
}
CREATE TABLE [dbo].[UserTransactions]
(
[Id] [int] IDENTITY(1,1) NOT NULL,
[Points] [int] NOT NULL,
[Date] [datetime] NOT NULL,
[UserId] [int] NOT NULL,
[DeviceId] [char](36) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TransactionTypeId] [tinyint] NOT NULL,
[ActionBy] [int] NOT NULL,
INDEX [idx_hash_UserTransactions_UserId] NONCLUSTERED HASH
(
[UserId]
)WITH ( BUCKET_COUNT = 524288),
PRIMARY KEY NONCLUSTERED
(
[Id] ASC
),
INDEX [UserTransactionsUIX_NonClustered] NONCLUSTERED HASH
(
[ActionBy],
[TransactionTypeId]
)WITH ( BUCKET_COUNT = 262144)
)WITH ( MEMORY_OPTIMIZED = ON , DURABILITY = SCHEMA_AND_DATA )
SELECT ISNULL(COUNT(*),0) from UserTransactions
where ActionBy=@IBidId and TransactionTypeId=@TId