473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Want expert opinion on a way of storing 'relations'

i've a database where relations are hold in a special way which the project
leaders think of as "performant and uncomplicated" but which is very
questionable to me:
------------------------------------------------
Table [Attributes]
Fields [AttributeID] and [AttributeText]

Table [Objects]
Fields object stuff.... and [AttributeIDs] (varchar with 0-20 ids usually)

in AttributeIDs there is a backslash separted list of Attribute-IDs like
'\34\12\2\78\'
so to get 20 object with a special attribute (which we need often) we do

SELECT TOP 20 *
FROM Objects
INNER JOIN Attributes
ON (Objects.AttributeIDs LIKE ('%\' + (CAST AttributeID AS varchar) + '\%'))
ORDER BY ObjectText

ps: to store data we need for communication we include a dozen of fields in
*every* table and its content makes about 100 bytes/record
------------------------------------------------
i would do this stuff with a table to store the object/attribute
correlations.

could someone tell me if that stuff makes any sense to an expert and how to
valuate it in regard of performance(we have big customers where that *is* an
issue), design, scalability, pragmatism and sense ;)

thanks in advance,
ViperDK
Jul 20 '05 #1
1 1633
Just for starters (I'm sure you'll get plenty of contributions to this
thread!)
Against this design:
(a) You won't be able to index the relations easily - this will be a major
database layer performance issue
(b) Constraints will be exceedingly difficult (although the architect is
probably performing constraints in the application layer)
(c) AttributeID violates first normal form (although the architect probably
doesn't care as he seems to be after an OO design rather than a relational
design)
(d) Your query will always scan the table because the wildcard search in the
join predicate is not useful as a search argument - would be the same
problem even if join predicate shifted to where clause btw.. This is a
related problem to (a)

For this design:
(a) Very (too) flexible - allows changes to be made at the application
easily without much consideration for impact on database (at the expense of
database performance & probably consistency also)

General comments - this design makes little sense to the relational DBA, as
it is so foreign to the concept of RDBMS. Even as an OODBMS it's a
questionable design as AttributeID could at least be normalised - possibly
even presented back to the application as this schema using a view if really
needed.

I have worked with similar projects, notably one where a heavy committment
to the application layer was made by the architect (using Java / Struts /
JDBC & Websphere technology). A similar RDBMS design was employed, although
a little more rationally - without your AttributeID fiasco. My instinctual
reaction was strongly against this at first, however I have to say that this
application performs fine (an international B2B website for a major US
supermarket brand) as the application layer has extensive caching technology
& the application layer has more knowledge about how / when to hit the
database. Sometimes there's more than meets the eye when you bump into one
of these type of designs. Sometimes the trade offs achieve significant goals
(mainly extensibility) that you might do well to seek out from the architect
of the system before standing your ground too strongly. Generally though -
if the architect can't point you to solid documentation that describes the
design / trade-offs, you should drive him / her for it in writing now
because if you don't, you'll be paying the price in trying to maintain that
system later..

HTH

Regards,
Greg Linwood
SQL Server MVP

"ViperDK (Daniel K.)" <vi**************@viperdk.dyndns.org> wrote in message
news:bp*************@news.t-online.com...
i've a database where relations are hold in a special way which the project leaders think of as "performant and uncomplicated" but which is very
questionable to me:
------------------------------------------------
Table [Attributes]
Fields [AttributeID] and [AttributeText]

Table [Objects]
Fields object stuff.... and [AttributeIDs] (varchar with 0-20 ids usually)

in AttributeIDs there is a backslash separted list of Attribute-IDs like
'\34\12\2\78\'
so to get 20 object with a special attribute (which we need often) we do

SELECT TOP 20 *
FROM Objects
INNER JOIN Attributes
ON (Objects.AttributeIDs LIKE ('%\' + (CAST AttributeID AS varchar) + '\%')) ORDER BY ObjectText

ps: to store data we need for communication we include a dozen of fields in *every* table and its content makes about 100 bytes/record
------------------------------------------------
i would do this stuff with a table to store the object/attribute
correlations.

could someone tell me if that stuff makes any sense to an expert and how to valuate it in regard of performance(we have big customers where that *is* an issue), design, scalability, pragmatism and sense ;)

thanks in advance,
ViperDK

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bose | last post by:
Hi I have to make export of SQL Server Database to MS Access and I have done it with the tables but now I need to transfer(export) the relations, keys and indexes. Can any1 tell me how to read...
2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
1
by: Jef De Rycke | last post by:
Hi access group, I have written code to create relations between tables according to a corresponding relations information table. At first I thought my code was not working properly because...
1
by: Randy Fraser | last post by:
How do I create a relationship on muliple columns in an untyped dataset. Why does this not work. da.Fill(ds) ds.Tables(0).TableName = "DesignSummary" ds.Tables(1).TableName = "FormulaSummary"...
2
by: Joe | last post by:
Hi I have a dataset with 3 tables and 2 relations Is there a way to when I am at 1 row to tell if there is a relation on that row ??? I have the code hardcoded but try to make it work if the #...
7
by: Matik | last post by:
Hi to everyone, My problem is, that I'm not so quite sure, which way should I go. The user is inputing by second part application a long string (let's say 128 characters), which are separated...
24
by: Phil Latio | last post by:
Let's say I have a simple web application running with just two MySQL tables. The tables structure is as follows: Table: category category_id (PK) category_name parent_category (FK)...
6
by: Lint Radley | last post by:
Hi Everyone, I need an opinion here on storing data for a program I am working on the processes DICOM images. Essentially, my program stores 25-45 (it varies depending on the user) ranges of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.