编译优化与编译目标的区别是什么

What is the difference between #pragma GCC optimize() and #pragma GCC target() and which one to choose when, what are the other options as well?