Which Database Design is more effective in this scenario?

Kiti

DB design 1: There is 1 table

     Create Table (id int primary key, name varchar(20), description varchar(10000));

DB design 2: There are 2 tables

       Create Table1 (id int primary key, name varchar(20));
       Create Table2 (id int primary key, description varchar(10000));

Note: each id must have a description associated with it. We don't query the description so often like name.

In the design 1, 1 simple query can get name & description, no need join but what if we have 1 million records, then will it be slow?

In the design 2, we need join so the database needs some searching & matching id --> this could be slow, but we don't query description often so it will be slow for sometime not all time.

So what is the better design in this scenario?

Branko Dimitrijevic

That's called vertical partitioning or "row splitting" and is no silver bullet (nothing is). You are not getting "better performance" you are just getting "different performance". Whether one set of performance characteristics is better than the other is a matter of engineering tradeoff and varies from one case to another.

In your case, 1 million rows will fit comfortably into DBMS cache on today's hardware, producing excellent performance. So unless some of the other reasons apply, keep it simple, in a single table.

And if its 1 billion rows (or 1 trillion or whatever number is too large for the memory standards of the day), keep in mind that if you have indexed your data correctly, the performance will remain excellent long after it became bigger than the cache.

Only in the most extreme of cases will you need to vertically partition the table for performance reasons - in which case you'll have to measure in your own environment with your own access patterns, and determine if it brings any performance benefit at all; and is it large enough to make up for the increased JOINing.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

implicit dynamic linking vs explicit dynamic linking - which is more effective?

分類Dev

class/interface design approach for given scenario

分類Dev

How to make more readable and shorter a karate scenario

分類Dev

More effective way to filter data in R

分類Dev

Can I design any lock-free solution for this scenario

分類Dev

Is it correct to have more than one Then in a single Cucumber scenario?

分類Dev

In which scenario we should consider creating manual VPC(and subnets) for KOPS?

分類Dev

Right way to design database

分類Dev

Mongoose/ MongoDB Database Design

分類Dev

Best way to create a multi relational database in my scenario

分類Dev

less or more - which to use when?

分類Dev

Database design for like/love relations

分類Dev

Database design User Group Orders

分類Dev

How to design a database for medical products

分類Dev

A Real World Example of Vector vs List showing scenario where each is more efficient than the other

分類Dev

Which design pattern to use on Java workflow

分類Dev

How to compare two NSDates: Which is more recent?

分類Dev

index vs iterator - which would be more efficient?

分類Dev

Which technique is more efficient for replacing records

分類Dev

What's the effective way to insert more a million rows into postgresql server from another postgres server using Java?

分類Dev

Any scenario in which String.isEmpty() returns true and String.isBlank() returns false for the same input?

分類Dev

Domain driven design - database transaction management

分類Dev

User-Role-Permission based database design

分類Dev

Is a repository only limited to the database in domain driven design?

分類Dev

Best way to manage multiple category in database design

分類Dev

How to design database in order to store "default" items

分類Dev

Database Design: Circular reference and how to correct it

分類Dev

User with multiple roles and multiple teams database design

分類Dev

MySQL Null or empty fields - New Database Design

Related 関連記事

  1. 1

    implicit dynamic linking vs explicit dynamic linking - which is more effective?

  2. 2

    class/interface design approach for given scenario

  3. 3

    How to make more readable and shorter a karate scenario

  4. 4

    More effective way to filter data in R

  5. 5

    Can I design any lock-free solution for this scenario

  6. 6

    Is it correct to have more than one Then in a single Cucumber scenario?

  7. 7

    In which scenario we should consider creating manual VPC(and subnets) for KOPS?

  8. 8

    Right way to design database

  9. 9

    Mongoose/ MongoDB Database Design

  10. 10

    Best way to create a multi relational database in my scenario

  11. 11

    less or more - which to use when?

  12. 12

    Database design for like/love relations

  13. 13

    Database design User Group Orders

  14. 14

    How to design a database for medical products

  15. 15

    A Real World Example of Vector vs List showing scenario where each is more efficient than the other

  16. 16

    Which design pattern to use on Java workflow

  17. 17

    How to compare two NSDates: Which is more recent?

  18. 18

    index vs iterator - which would be more efficient?

  19. 19

    Which technique is more efficient for replacing records

  20. 20

    What's the effective way to insert more a million rows into postgresql server from another postgres server using Java?

  21. 21

    Any scenario in which String.isEmpty() returns true and String.isBlank() returns false for the same input?

  22. 22

    Domain driven design - database transaction management

  23. 23

    User-Role-Permission based database design

  24. 24

    Is a repository only limited to the database in domain driven design?

  25. 25

    Best way to manage multiple category in database design

  26. 26

    How to design database in order to store "default" items

  27. 27

    Database Design: Circular reference and how to correct it

  28. 28

    User with multiple roles and multiple teams database design

  29. 29

    MySQL Null or empty fields - New Database Design

ホットタグ

アーカイブ