Page 1 of 3 123 LastLast
Results 1 to 15 of 43
  1. #1
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    31

    Unanswered: Third dimension, or something instead?

    I have table with many rows, and I want to change the structure of base. It is possible to create 3-dimensions table?

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    What is that suppose to mean?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    31
    Standart table have 2 dimensions -> rows and columns. But I need third one: to each record I want to add as many "sub-records" as I need. To visually decribe it, I can say it looks like third dimension

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Just create a child table with the Parents key, and whatever the key of the child would be
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    31
    I thought about it, but about 10.000 tables isn't too much? I supose, that numer of rows will have main table, and to each row I need new table.

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    not 10,000 tables -- just one

    table with two dimensions:

    CREATE TABLE TWO_D
    ( foo INTEGER NOT NULL
    , bar INTEGER NOT NULL
    , PRIMARY KEY ( foo, bar )
    , otherstuff VARCHAR(937)
    )

    table with three dimensions:

    CREATE TABLE THREE_D
    ( foo INTEGER NOT NULL
    , bar INTEGER NOT NULL
    , qux INTEGER NOT NULL
    , PRIMARY KEY ( foo, bar, qux )
    , otherstuff VARCHAR(937)
    )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by Ivenesco
    I thought about it, but about 10.000 tables isn't too much? I supose, that numer of rows will have main table, and to each row I need new table.

    WTF


    What's your job title?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  8. #8
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    31
    Quote Originally Posted by Brett Kaiser
    WTF


    What's your job title?
    I'm a student, and I'm need a lot of data to learn some processing on many files (search engine, encrypt algorithms etc.). I wrote an app. (in VB 2005), which is gathering url's (and downloading sources) over the web, but my database is too slow when there is more than 100k url's (and information about like: size, mime type, sha1 etc.). So I want to divide data: main table with main url's like: "www.microsoft.com" or "www.imdb.com" and for each main url I want to create next table -> container for sub-url's like : "www.imdb.com/something/else.html". This dividing is necessary due to app. (it's working too slow with one table with more than 100k rows).
    My question is: is there any method to do this dividing other way than creating sub-tables? There will be about 10k main url's, and I think 10k tables is too much for database

  9. #9
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    3 dimensional table? is that a box?

    oh wait I have heard of the Buckaroo Bonzai School of Database Design, but that was all about the fifth dimension and I never cared for their music. That's a double popular culture reference for those keeping score.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  10. #10
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    seriously, why don't you post you table definitions and indicate where the indexes are and an example of a query that is too slow.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  11. #11
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    31
    Quote Originally Posted by Thrasymachus
    seriously, why don't you post you table definitions and indicate where the indexes are and an example of a query that is too slow.
    http://www.dbforums.com/showthread.php?t=1626825
    8th post
    Tables are very simple: "queue" and "stack" has only 3 columns

  12. #12
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    No, It's just 1 Table

    CREATE TABLE myURLStats (
    URL varchar(255)
    , size int
    , [mime type] varchar(n)
    , sha1 varchar(n)
    , etc varchar(n)
    , Add_Dt datetime DEFAULT(GetDate())
    )
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  13. #13
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    31
    Yes... I wrote, that I have this table... But it's slow. One table where I must run SELECT for each new record is too slow to my app, when there is more than 100k records. Please, do not send me another table, with some columns, beceuse I have done it. My question is, how can I divide it(or add 3 dimension -> like a cube )? No how to create one table...

  14. #14
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    where is the 3rd dimension, please?

    perhaps you could start by esplaining what the first two dimensions are

    because i see only one dimension -- urls
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  15. #15
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I'm done

    This message is to short

    oh, and btw 100k Rows is nothing

    Unless you are trying to return that in a SELECT
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •