Implications for using an identity column or homegrown table table

I have an outdated system that uses a table to arrange numbers. The table has the following definition:

dbo.id_table
(
    table_name char(64) NOT NULL,
    id_type char(5) NOT NULL,
    data_type char(5) NOT NULL,
    next_id_number int NOT NULL,
    next_id_max char(15) NOT NULL
)
PRIMARY KEY CLUSTERED 
(
    table_name ASC
) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

This table is functionally equivalent for an identity column.

Here's how the table is used: -There is a procedure to get the following id value in the table. eg.

exec id_proc 'bryans_table', @some_int_value output

I am looking for an expert to answer the following question:

What are the performance implications (as much as possible, as much as possible) for using this design with SQL Server 2008 R2 (currently working in compatibility mode, but plans to use full 2008 R2 in the future) or using a regular identity column? Is it really a scale?

, , , ( )? .

( , - )

+4
2

, (- X , ). , INSERT ( INSERT , ). .

.

, , . ( +1000) . . , INSERT, , .. : IDENTITY ( ...)

+8

,

-

create table dummy_id (
  id int identity not null,
  dummy int not null
)

- proc

create proc dummy_id_gen(@newid int output) as
begin

begin tran
insert dbo.dummy_id (dummy) values (0)
select @newid = scope_identity()
rollback tran

end

- proc

declare @newid int
exec dummy_id_gen @newid = @newid output
select @newid as newid

1

0

Source: https://habr.com/ru/post/1502462/


All Articles