Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Posts
    2

    optimising databases

    Hi everyone,

    Which concept in your opinion is better when it comes to big and complicated queries that require data from many tables? Do you try to keep it highly normalized (2NF?) or denormalize into big blocks of data? Do you use views? I use postgreSQL and did many things to improve performance but select queries are still not fast enough. Most of them require data from seven tables and there is around one thousand of them for each user's request. Does organising data in different way help to improve perfomance? All help will be appreaciated.

    Regards,
    N.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    I go for highly normalized. Third normal form (TNF) is the lowest that I'll voluntarily go in an OLTP database.

    Yes, changing the way that data is organized will change system performance. In general, I prefer to keep the individual pieces (rows) of data atomic, meaning that they can't be subdivided in any meaningful way.

    Where performance is concerned, I think that every row should have a Primary Key, and every row that needs to reference another row should use a Foreign Key. I always index the Primary Key (usually implicitly via constraints), and almost always index Foreign Keys (again, usually using constraints).

    If you are really needing to execute a thousand queries for user requests, then this is fertile ground for a datawarehouse. I wouldn't try to handle that type of processing in an OLTP database.

    -PatP

  3. #3
    Join Date
    Apr 2008
    Posts
    29
    nupek:
    As Pat said, normalize at least to 3NF. In OLTP you can gain a lot by normalizing and building the proper indexes.

    You can try creating some "materialized" views to help with those thousand queries...

  4. #4
    Join Date
    Apr 2008
    Posts
    2
    Thank you for the answers, Pat, m42. I am afraid that data warehouse is not an option but my database is normalized to 2NF at least and I use indexes as well as tried to use cluster on index. Hope it will not be a complete disaster in the end. I also decided to use postgresql instead of mysql hoping it will be faster on many cores. Do you think it was wise?

    Regards,
    Nupek.

  5. #5
    Join Date
    Apr 2008
    Posts
    29
    If warehousing is not an option, i guess you really shoud give "materialized views" a try.. I don't know if you're familiar with the concept but think of it as a table to hold your frequent query results...

Posting Permissions

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