How would you normalize / optimize this mysql database?

I have a site for ads with a lot of categories.

When a user publishes an “announcement” on a website, there is some basic information (name, city, price, heading, text, etc.) that needs to be filled out. And also, depending on which category 'the user wants to include the ad, you will need to fill out a few more fields, for example: if the category is “cars”, then the “year” run also appears.

Now my search engine will query the table for everything that the user wants to find ...

My question is: how would you build this database to be the most efficient and fastest?

I read about normalization, but I don’t really understand much of this ... So, whatever you explain, please explain it as thoroughly as possible.

thanks

+3
source share
8 answers

Normalizing a database usually does not improve speed; it helps remove redundancy and improve consistency.

If speed is the goal, you really need to de-normalize things. Complex joins are usually performance bottlenecks in large databases, and reducing joins by denormalizing tables improves performance.

+2
source

.

0

, :

  • , , , , , .. , , , , , , . .

  • , , xml, json . , , , - Lucene .

0

. 1) , . 2) / : , , . 3) : . , , . 4) - Sachin Chourasiya

0

, , , , (-), (, , , , , ).

- : .

  • 1) : , ,
    • pro:
    • pro: ( , ..)
    • pro: SQL, .
    • con:
    • con: , ( )
  • 2)
    • pro: (1)
    • con: SQL
    • con: : 100

, (2) , . , .

: mysql, postgresql : . pg ads, cars, ads (). , .., . vans convertibles, ads, cars, , . (2), ? , ads ( cars cars, convertibles and vans, ). sql: select * from ads where title='foo', ads , , cars . . , / categ , ..

, , , -. , (tm).


mysql postgres. pg - , IMHO mysql, . , postgres, mysql, mysql 2.something, 10 , ( ), , , mysql. : " " mysql - myisam, , .. , . IMHO , . , myisam - NOGO. Innodb, , , , .

postgres , , (, ).

ok, , : -)

0

. , . , .. , , :

  • ID

  • ID
  • ad_id

, .

, , - . "build-database-inside-database". . , , VARCHAR. , (, , / ..) .

0

MongoDB , .

0

Source: https://habr.com/ru/post/1722541/


All Articles