Unit 6 Flashcards

1
Q

Which of the following is true about a transaction?

It is a group of database operations that are combined into a logical unit.

By default, each SQL statement is treated as a separate transaction.

You can combine any number of SQL statements into a single transaction.

A

All of the above

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A ________ occurs when neither of two transactions can be committed because they each have a lock on a resource needed by the other.

A

Deadlock

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

SQL Server’s lock manager always tries to lock resources

A

at the highest possible granularity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

One of the drawbacks of using the SERIALIZABLE isolation level is

A

it can cause severe performance problems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

By default, SQL Server is in autocommit mode. This means

A

unless you explicitly start a transaction using the BEGIN TRAN statement, each statement is automatically treated as a separate transaction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A lost update occurs when

A

two transactions select the same row and then update the row based on the values originally selected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which statement can you use to explicitly start a transaction?

A

BEGIN TRAN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does SQL Server automatically use to avoid some concurrency problems?

A

locks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If @@TRANCOUNT is equal to 1, then the COMMIT TRAN statement

A

decrements @@TRANCOUNT and commits the transaction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What kind of lock only allows one transaction to access a resource?

A

exclusive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If you don’t group statements into explicit transactions, SQL Server automatically treats each SQL statement as a separate what?

A

transaction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If you’ve declared save points, the COMMIT TRAN statement

A

commits the entire transaction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which lock indicates that SQL Server plans to obtain a shared lock or an exclusive lock on a finer-grain resource?

A

intent lock

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

If neither of two transactions can be committed because they each have a lock on a resource needed by the other, it’s called

A

a deadlock

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following is the default transaction isolation level for SQL Server?

A

READ COMMITTED

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Each of the following is a valid reason to explicitly code a transaction except for one. Which one?

A

The results of a SELECT query will be used as a subquery.

17
Q

When you commit a transaction,

A

the operations performed by the SQL statements become a permanent part of the database

18
Q

Which system function can you use to determine how many levels deep transactions are nested?

A

@@TRANCOUNT

19
Q

Which of the following is not one of the four types of concurrency problems?

A

integrity reads

20
Q

Which of the following is the most restrictive transaction isolation level?

A

SERIALIZABLE

21
Q

The relative amount of data that’s included in a resource can be referred to as the resource’s

A

granularity

22
Q

A dirty read occurs when

A

a transaction selects data that isn’t committed by another transaction

23
Q

Each of the following techniques can help to prevent deadlocks except for one. Which one?

Don’t leave transactions open any longer than necessary.

Use the highest transaction isolation level possible.

Schedule transactions that modify a large number of rows to run when no other transactions will be running.

If you code two transactions that update the same resources, code the updates in the same order in each transaction.

A

Use the highest transaction isolation level possible.

24
Q

What is lock promotion?

A

the conversion of a less exclusive lock to a more exclusive lock

25
Q

Concurrency is

A

more of a problem on larger systems with more users and more transactions

only a problem when data is being modified, not when two or more transactions simply read the same data

the ability of a system to support two or more transactions working with the same data at the same time

all of the above

26
Q

What is lock escalation?

A

the conversion of several finer-grained locks to a single coarse-grain lock