One often hears "workers are paid according to their productivity" and "the least productive workers are laid off first". These are mutually incompatible statements as commonly used. Either workers are paid according to their productivity, meaning no productivity basis exists for determining which are laid off, or they are paid on bases other than their productivity and laid off on that basis. Productivity is just output over input. If workers are paid for their productivity, the input, their wages, has been adjusted to equalize productivity among workers, so how can some be less productive than others? Individual productivity may be difficult or even impossible to measure, but that would just mean it is irrelevant to pay and both statements are false. It may be difficult to anticipate when hiring, but new hires that don't work out are often terminated, and if not, wages can be adjusted by raises or their absence over time. There is only one sense in which these statements can be understood together.
In a downturn, what changes is the relative desirability or values of outputs, not inputs. The price usually doesn't even change much, but the quantity demanded. It is the work that becomes less productive, not the worker. Prices are sticky and wages are even more sticky. The worker that is laid off is no less productive than the co-worker that stays behind, rather, the workers that suffer layoffs are less productive in the sense of being less desired than workers that don't suffer layoffs. Productivity is an industry concept, only wages are an individual one. It is not productivity the manager uses in selecting which workers to lay off, rather, it is desirability the market uses in selecting which industries to reduce. Managers could reduce prices and wages to maintain quantity and employment, but some costs are fixed, some work has to be done, and some are other inputs over which they have no control, so it is easiest to treat both prices and wages as fixed and allow quantity and employment to fall. So what criteria do managers use in layoffs when all their workers have become less productive in the sense of desired? They may choose to layoff those with the highest wages to minimize number of layoffs and keep those more able to improve or less likely to demand their productivity or cause trouble, or they may select on connections or influence, pliability or sociability, seniority, or even age, race, and sex, but it is not productivity, per se, in the common sense of the meaning. Layoffs are fundamentally about discrimination. This is probably why most managers dislike doing it, or at least the good ones.