If you need to show user different content whether a table is empty or not. So you would need to count table rows for that. Counting every row will iterate through the table rows and is really slow. The best method would be to get the first row from the table, if it exists the table has results and vice versa. You can ever more optimize this with selecting NULL, that eliminates the need of reading column data.
Source code viewer
Programming Language: MySQL