A
A
alekseivanov2015-06-02 04:04:43
PHP
alekseivanov, 2015-06-02 04:04:43

How to repeat a VK feed?

I want to copy VKontakte functions, created pages and groups.
In addition, each page and group uses a separate table in the database.
I wanted to make sql queries like "SELECT * from group1, group2 ORDER by date limit=10 ", but it turns out that the functionality of selecting from several tables is such that the result is "glued" rows, which of course I don't need at all.
Is it possible to select from multiple tables in such a way that the result is unglued, jumbled rows?
If yes, then how.
If not, then how can this function be implemented in another way?
Write down all the posts on the site in one table?
Will not too large table size slow down sql queries then?
Because I thought 10,000 tables with 10,000 rows are better than a table with 100,000,000 rows.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rinat Shaikhutdinov, 2015-06-02
@rinat_crone

Of course, I wish you growth, but it is unlikely that you will have 100 000 000records in one plate in the foreseeable future (do not store logs there, well). Therefore, do not engage in premature optimization, use one table in an adequate database (I recommend PostgreSQL) and correct indexes. This will solve all your sampling problems and free up time for product development.
Good luck!
PS We store millions of records, we do not see unsolvable problems or scaling problems in the future.

I
index0h, 2015-06-02
@index0h

Never use SELECT * . Specify exactly what and how you want to receive. I recommend writing control structures not at random, but in UPPER CASE.
If you do not make queries with nonsense in the ORDER BY RAND () style, and write the indexes correctly, there should not be a problem.
It makes sense to think about it only if the task is horizontal scaling.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question