-- for 10% -- SELECT * FROM table_name ORDER BY random() LIMIT (SELECT (COUNT(*)*0.01)::INT FROM table_name);