<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1005921" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1005921</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/db-structurespeed#comment-1031579</link>
    <description> &lt;p&gt;The design depends on what you want to do with the table. If you&#039;re using it as a read-only repository of data, and will not be using it to write your transactions, then some data redundancy can be good. I&#039;m not saying that you should plop everything into one big table (although this might be an option), but it depends on both the situation and how you will be using the data, especially in the future.&lt;/p&gt;
&lt;p&gt;Here&#039;s an example. Let&#039;s say that you want to give your customers access to their order data. Let&#039;s say you have (in a separate database) a customer table, an order header table, an order line table, and a shipment table.&lt;/p&gt;
&lt;p&gt;If this was the design you were forced to work with, you would have to get orders and sales separately if you wanted to provide a day-by-day list of tranactions. That&#039;s because you can&#039;t join orders to sales because there may be days with sales but no orders, or vice versa. Outer joins would be tricky. The SQL would be somewhat slow.&lt;/p&gt;
&lt;p&gt;If, however, you exported your data in the format that you want to display it in, you could have a customer table and a orders/sales table. That orders/sales table could contain the order total on each line -- redundant, but it would allow you have one less join in your query and would also allow you to show a &quot;percent of total&quot; pretty easily.&lt;/p&gt;
&lt;p&gt;That&#039;s why I say &quot;it depends&quot;. You should try a few different designs to see what works best.&lt;/p&gt;
&lt;p&gt;I also agree with Anti -- you should let the database do the work. Don&#039;t think this through like it&#039;s procedural code. Do one SELECT and return all the rows you need. Then fetch from your result set. If you send 300 queries per customer, that&#039;s 300 queries that have to be parsed and executed, and that equals more overhead.&lt;/p&gt;
&lt;p&gt;Ralph Slate&lt;/p&gt;
&lt;p&gt;------------------&lt;br /&gt;
 &lt;a href=&quot;http://www.hockeydb.com&quot; class=&quot;bb-url&quot;&gt;http://www.hockeydb.com&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 15 May 2000 15:37:00 +0000</pubDate>
 <dc:creator>Ralph Slate</dc:creator>
 <guid isPermaLink="false">comment 1031579 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I have no tables created yet,</title>
    <link>https://www.webmaster-forums.net/web-database-development/db-structurespeed#comment-1031578</link>
    <description> &lt;p&gt;I have no tables created yet, but everything will look as I explained (2 tables assigning strings, 1 table with data).&lt;br /&gt;
Thanks for your hints!&lt;/p&gt;
&lt;p&gt;Christian Becker&lt;/p&gt;
 </description>
     <pubDate>Mon, 15 May 2000 13:57:00 +0000</pubDate>
 <dc:creator>ChrisB</dc:creator>
 <guid isPermaLink="false">comment 1031578 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/db-structurespeed#comment-1031577</link>
    <description> &lt;p&gt;OK,&lt;br /&gt;
some general tips.&lt;/p&gt;
&lt;p&gt;Let the Database-Software do the work.&lt;br /&gt;
That&#039;s what it was designed for.&lt;/p&gt;
&lt;p&gt;Try to normalise your tables (at least BNF if not 6NF).&lt;/p&gt;
&lt;p&gt;If you don&#039;t need intermediate results select the finals direcetly.&lt;br /&gt;
This can usually be achieved by (extensive) use of joins.&lt;/p&gt;
&lt;p&gt;Use the joins that your dbsw handles best, usually left joins.&lt;/p&gt;
&lt;p&gt;Don&#039;t select more columns than you need.&lt;/p&gt;
&lt;p&gt;If I understood your problem right you should only need _ONE_ query and a few subsequent fetch-rows.&lt;/p&gt;
&lt;p&gt;I&#039;m still interested in your db contents.&lt;/p&gt;
 </description>
     <pubDate>Mon, 15 May 2000 12:52:00 +0000</pubDate>
 <dc:creator>anti</dc:creator>
 <guid isPermaLink="false">comment 1031577 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I see, so SQL server is fast</title>
    <link>https://www.webmaster-forums.net/web-database-development/db-structurespeed#comment-1031576</link>
    <description> &lt;p&gt;I see, so SQL server is fast in collecting many little pieces of data from huge tables?&lt;br /&gt;
Since I need to query the 3-tables-structure about 100 times per single user query, there will be about 300 SQL queries to resolve the strings.&lt;br /&gt;
How to make this fast, perhaps by combining sub-queries where applicable?&lt;br /&gt;
Can you give me some general hints to optimize speed and to lower SQL traffic?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Christian Becker&lt;/p&gt;
 </description>
     <pubDate>Mon, 15 May 2000 12:32:00 +0000</pubDate>
 <dc:creator>ChrisB</dc:creator>
 <guid isPermaLink="false">comment 1031576 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/db-structurespeed#comment-1031575</link>
    <description> &lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think you are on the right way.&lt;/p&gt;
&lt;p&gt;Always normalize your database.&lt;br /&gt;
Never store duplicate data.&lt;br /&gt;
(Well, sometimes do it, but be carefull with it).&lt;/p&gt;
&lt;p&gt;If you tell use you db definition (show us your create statements) we might be able to offer more support.&lt;/p&gt;
&lt;p&gt;ciao&lt;br /&gt;
Anti&lt;/p&gt;
 </description>
     <pubDate>Mon, 15 May 2000 08:16:00 +0000</pubDate>
 <dc:creator>anti</dc:creator>
 <guid isPermaLink="false">comment 1031575 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
