Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Top Partitions by Resource Use
00:00
5 left

Top Partitions by Resource Use

MediumSQL · PostgreSQL

Problem

Write a query to identify top-performing partitions based on resource consumption.

Use the partition catalog and resource usage data. Treat higher total credits consumed as better performance for this task. Return the highest-ranked partitions, including ties at the third rank.

Output

  1. One row per qualifying partition with partition_id, table_name, total_credits_used, total_bytes_scanned, and resource_rank
  2. Include partitions ranked 1 through 3, including ties
  3. Order by resource_rank, descending total_credits_used, then ascending partition_id

Schema

partition_catalog
ColumnTypeDescription
partition_idPKINTUnique partition identifier
database_nameVARCHAR(100)Snowflake database containing the table
schema_nameVARCHAR(100)Snowflake schema containing the table
table_nameVARCHAR(100)Table containing the partition
partition_labelVARCHAR(100)Human-readable partition label
partition_resource_usage
ColumnTypeDescription
usage_idPKINTUnique resource usage record
partition_idINTReferenced partition identifier
query_idVARCHAR(50)Query associated with the usage record
credits_usedDECIMAL(12,2)Credits consumed by the query
bytes_scannedBIGINTBytes scanned for the partition
execution_msINTQuery execution time in milliseconds
Tablespartition_catalogpartition_resource_usage
Interviewer

Your question is Top Partitions by Resource Use. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.