Hello Anh, thank you very much again. I only have one question more.
Finally I will use custom tables, however in the documentation I found the last example to search in the custom tables:
global $wpdb;
$ids = $wpdb->get_col( "SELECT ID FROM your_table WHERE field1 = 'value1' OR field2 = 'value2'" );
$query = new WP_Query( [
'post_type' => 'post',
'post__in' => $id,
] );
So you first I should make a query to the custom tables and next you make a second query to wordpress post table passing the ID from first query.
If for example the first query get 5000 records so you pass 5000 ids for the second query?
Do you think taht it is most optimize? I am scare about it and I don't know if is a good idea use metabox to work with big data in database.
Can you recomend me something?
When I use it:
$query = new WP_Query( [
'post_type' => 'post',
'post__in' => $id,
] );
I can't imagine one query passing 5000 records the SQL query could be:
where ID = 'ID_1' OR ID = 'ID_2' OR ID = 'ID_3' ....... ID = 'ID_5000'