I have a simple query I want to run on Snowflake, that take records with a condition (lets say, start_time) , using a sample of 20,000 rows.
The DB is pretty heavy - 1650 columns .
the 2 queries that I'm trying are :
SELECT * FROM ( SELECT * FROM <table_name> WHERE start_time BETWEEN '2023-04-01' AND '2023-04-21' ) SAMPLE (20000 ROWS)
and
SELECT * FROM <table_name> WHERE start_time BETWEEN '2023-04-01' AND '2023-04-21' ORDER BY RANDOM() LIMIT 20000
Both queries take about 20 minutes to run, which is way too long, I think. Am I doing something wrong? Is there a way I can improve those run times ?
– AvitanD May 08 '23 at 12:33