A
A
amiak2015-09-29 16:01:11
MySQL
amiak, 2015-09-29 16:01:11

How to sort data from two tables with lots of data?

There are two tables with a huge number of posts. 1 - post archive, 2 - current post storage. How to quickly get 20 posts from two given tables, sorting by author, for example.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
O
Optimus, 2015-09-29
Pyan @marrk2

"Big" is how much? What is the purpose of your current posts and archive together, why archive then? How many posts from each and with what sorting?

M
Max, 2015-09-29
@MaxDukov

to make an index on the author?
"a huge amount" and "quickly" - how much in measurable units?

A
amiak, 2015-09-29
@amiak

There are 10k posts in the archive in the current 4k. Indexes are worth.

M
Mikhail Livach, 2015-09-29
@Mausglov

afaik, no way. If the sort is not by the primary key, then MySQL makes a temporary table, and only then sorts.

L
lega, 2015-09-29
@lega

How to quickly get 20 posts from two given tables, sorting by author, for example.

Take 20 posts from each table with the desired sorting, manually merge.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question