[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-24。"],[[["\u003cp\u003eThe \u003ccode\u003eINFORMATION_SCHEMA.JOBS_TIMELINE_BY_FOLDER\u003c/code\u003e view provides near real-time metadata for all BigQuery jobs within a specified project's parent folder and its subfolders, including both running and completed jobs.\u003c/p\u003e\n"],["\u003cp\u003eAccessing this view requires the \u003ccode\u003ebigquery.jobs.listAll\u003c/code\u003e IAM permission for the parent folder, which is included in the Folder Admin and BigQuery Admin roles.\u003c/p\u003e\n"],["\u003cp\u003eThe view's data is structured to provide a row for each second of execution for every BigQuery job, with columns detailing information like \u003ccode\u003eperiod_start\u003c/code\u003e, \u003ccode\u003eperiod_slot_ms\u003c/code\u003e, \u003ccode\u003ejob_id\u003c/code\u003e, \u003ccode\u003ejob_type\u003c/code\u003e, and more.\u003c/p\u003e\n"],["\u003cp\u003eData within the \u003ccode\u003eJOBS_TIMELINE_BY_FOLDER\u003c/code\u003e view is partitioned by the \u003ccode\u003ejob_creation_time\u003c/code\u003e column and clustered by \u003ccode\u003eproject_id\u003c/code\u003e and \u003ccode\u003euser_email\u003c/code\u003e, and it retains data for the past 180 days along with currently running jobs.\u003c/p\u003e\n"],["\u003cp\u003eQueries against this view must include a region qualifier (e.g., \u003ccode\u003eregion-us\u003c/code\u003e) and the query execution location must match the \u003ccode\u003eINFORMATION_SCHEMA\u003c/code\u003e view's region, the data from this view will be scoped to that specific region.\u003c/p\u003e\n"]]],[],null,["# JOBS_TIMELINE_BY_FOLDER view\n============================\n\nThe `INFORMATION_SCHEMA.JOBS_TIMELINE_BY_FOLDER` view contains near real-time\nBigQuery metadata by timeslice for all jobs submitted in the\nparent folder of the current project, including the jobs in subfolders under it.\nThis view contains both running and completed jobs.\n\nRequired permissions\n--------------------\n\nTo query the `INFORMATION_SCHEMA.JOBS_TIMELINE_BY_FOLDER` view, you need\nthe `bigquery.jobs.listAll` Identity and Access Management (IAM) permission for the parent\nfolder. Each of the following predefined IAM roles includes the\nrequired permission:\n\n- Folder Admin\n- BigQuery Admin\n\nFor more information about BigQuery permissions, see\n[Access control with IAM](/bigquery/docs/access-control).\n\nSchema\n------\n\nWhen you query the `INFORMATION_SCHEMA.JOBS_TIMELINE_BY_*` views, the query\nresults contain one row for every second of execution of every\nBigQuery job. Each period starts on a whole-second interval and\nlasts exactly one second.\n\nThe `INFORMATION_SCHEMA.JOBS_TIMELINE_BY_*` view has the following schema:\n| **Note:** The underlying data is partitioned by the `job_creation_time` column and clustered by `project_id` and `user_email`.\n\nData retention\n--------------\n\nThis view contains currently running jobs and the job history for the past 180\ndays.\n\nScope and syntax\n----------------\n\nQueries against this view must include a [region qualifier](/bigquery/docs/information-schema-intro#syntax).\nIf you don't specify a regional qualifier, metadata is retrieved from all\nregions. The following table explains the region scope for this view:\n\nReplace the following:\n\n- Optional: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project. If not specified, the default project is used.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: any [dataset region name](/bigquery/docs/locations). For example, ```region-us```.\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n | **Note:** You must use [a region qualifier](/bigquery/docs/information-schema-intro#region_qualifier) to query `INFORMATION_SCHEMA` views. The location of the query execution must match the region of the `INFORMATION_SCHEMA` view.\n\n\u003cbr /\u003e\n\nExamples\n--------\n\nThe following examples show how to query the\n`INFORMATION_SCHEMA.JOBS_TIMELINE_BY_FOLDER` view.\n\n### Get the number of unique jobs\n\nThe following query displays the number of unique jobs running per minute in the\ndesignated project's folder: \n\n```googlesql\nSELECT\n TIMESTAMP_TRUNC(period_start, MINUTE) AS per_start,\n COUNT(DISTINCT job_id) AS unique_jobs\nFROM\n `region-us`.INFORMATION_SCHEMA.JOBS_TIMELINE_BY_FOLDER,\n UNNEST(folder_numbers) f\nWHERE\n my_folder_number = f\nGROUP BY\n per_start\nORDER BY\n per_start DESC;\n```\n| **Note:** `INFORMATION_SCHEMA` view names are case-sensitive.\n\nThe result is similar to the following: \n\n```\n+---------------------------+---------------------------------+\n| per_start | unique_jobs |\n+---------------------------+---------------------------------+\n| 2019-10-10 00:04:00 UTC | 5 |\n| 2019-10-10 00:03:00 UTC | 2 |\n| 2019-10-10 00:02:00 UTC | 3 |\n| 2019-10-10 00:01:00 UTC | 4 |\n| 2019-10-10 00:00:00 UTC | 4 |\n+---------------------------+---------------------------------+\n```\n\n### Calculate the slot-time used\n\nThe following query displays the slot-time used per minute in the\ndesignated project's folder: \n\n```googlesql\nSELECT\n TIMESTAMP_TRUNC(period_start, MINUTE) AS per_start,\n SUM(period_slot_ms) AS slot_ms\nFROM\n `region-us`.INFORMATION_SCHEMA.JOBS_TIMELINE_BY_FOLDER,\n UNNEST(folder_numbers) f\nWHERE\n my_folder_number = f\n AND reservation_id = \"my reservation id\"\n AND statement_type != \"SCRIPT\"\nGROUP BY\n per_start\nORDER BY\n per_start DESC;\n```\n| **Note:** `INFORMATION_SCHEMA` view names are case-sensitive.\n| **Note:** Projects within a single folder can be assigned to more than one reservation. `JOBS_TIMELINE_BY_FOLDER` can provide data across multiple reservations. When summing `period_slot_ms`, ensure that you are filtering for individual reservations.\n\nThe result is similar to the following: \n\n```\n+---------------------------+---------------------------------+\n| per_start | slot_ms |\n+---------------------------+---------------------------------+\n| 2019-10-10 00:04:00 UTC | 500 |\n| 2019-10-10 00:03:00 UTC | 1000 |\n| 2019-10-10 00:02:00 UTC | 3000 |\n| 2019-10-10 00:01:00 UTC | 4000 |\n| 2019-10-10 00:00:00 UTC | 4000 |\n+---------------------------+---------------------------------+\n```"]]