Showing posts with label requested. Show all posts
Showing posts with label requested. Show all posts

Friday, March 9, 2012

Opinion Requested: Multi-Table Design

I have about a 35000 record table. There are about 14 entries in this table that relate to "sections". Each of these sections can have up to 20 values. This lends itself to a design like:


big_table [one-to-one] big_table_has_sections [many-to-many] sections

or, more concretely:


BuildingConstructionType
relates to
ConstructionHasTypes
relates to
Types

Where BuildingConstructionType is one of 14 fields in the 35000 record "big" table, ConstructionHasTypes is the one-to-one intermediary relation that relates many-to-many with Types (the sections).

Unfortunately, with 35000 records, this big_table_has_sections seems like it might bloat. Is this a good solution?In order to facilitate what I think you are trying to accomplish, I don't know of any better way. Presumably the cross reference table is smallish in nature (i.e. composed of 2-3 key fields) and therefore should be indexed for quicked retrieval.

The obvious difficulty lies in how to retrieve the data. Your concerns for bloat are well founded as you will be using joins to return the appropriate dataset. If you user the query analyzer you will see that even simple joins between 2 tables using indexed keys are typically the most expensive (time and resource) operation in getting the data back. The reason for this is that sql does a table scan each and every time!

For this reason when dealing with tables of any sgnificant size I always use a stored procedure that employs one or more temporary tables which are populated using the appropriate where clause(s). Then I perfrom any joins using the temporary tables previously generated. That way the table scan will only go through the 100 or whatever number of BuildingConstructionType records in the temporary table instead of all 35000.

Granted, doing this takes a little more time and effort but my clients have tables containing 2.5 -3 million records with joins up the kazoo and I can still kick out result set in under a second.

Hope this is helpful and feel free to ask for any additional assistance if required.

Cheers

Gary|||Thanks... that's what I feared. It would be great if I could represent a vector effectively, but that doesn't appear to be consistent with the declarative nature of SQL.

Opinion Requested on Developer Permissions

We are trying to restrict developer permissions in our development environment. One thought is to add developers to db_datareader, db_datawriter, db_ddladmin, db_securityadmin and then revoke various permissions from ddladmin and securityadmin. The goal is to allow developer to create stored procedures and assign permissions to the stored procedures.

Another option is to place all developers in the same role and ask them to create all procedures using that role name (ex: dev_role.sp_procedurename). By doing this each developer will be able to run stored procedures created by another developer. The down side is the permissions do not match Model Office/User Test and Production.

Any suggestions on how to handle this situation?

Thanks, DaveI have 3 instances on 2 boxes..

DEV, QA and PROD...

Let the developers knock themsleves out in DEV...hopefully using some kind of version control

Promote all the code and YOU execute it in QA..they're not allowed in there

QA tests the code

QA gets signed off

Code is the promoted to prod on another box...|||We have the same thing here as Brett does there. Developers get added to the db_owners group in development, and are barred from using anything but the application logins in QA and prod (too hard to police, anyway). No one ever gets sysadmin on anything (and oh, how they ask).

Saturday, February 25, 2012

Operating system error 1450(Insufficient system resources exist to complete the requested se

Hello!

Hopefully someone can help me.

I have scripts to refresh database as SQL daily jobs. (O.S is Win2K3 and SQL server 2000 and SP4) It was worked and I got the following message this morning from SQL error log.

Internal I/O request 0x5FDA3C50: Op: Read, pBuffer: 0x0D860000, Size: 65536, Position: 25534864896, RetryCount: 10, UMS: Internal: 0x483099C8, InternalHigh: 0x0, Offset: 0xF1FF1E00, OffsetHigh: 0x5, m_buf: 0x0D860000, m_len: 65536, m_actualBytes: 0, m_errcode: 1450, BackupFile: \\XAPROD12MASTER\XAPROD\XAPROD_db_200701290000.BAK

BackupMedium::ReportIoError: read failure on backup device '\\XAPROD12MASTER\XAPROD\XAPROD_db_200701290000.BAK'. Operating system error 1450(Insufficient system resources exist to complete the requested service.).

This sounds exactly like an OS bug that we saw a long time ago where the Windows Remote File cache was behaving poorly and running out of its own buffers.

The best approach is to take this to Windows and see if there's a patch.