You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PrestoSQL中slug的作用及与token的区别解析(3XX版本新增参数说明)

Hey there! Let's break down your questions about slug in PrestoSQL step by step:

1. General role of slug in PrestoSQL

In short, a slug is a human-readable, concise identifier designed to replace long, opaque IDs (like UUIDs) for resources in PrestoSQL. It’s meant to make it easier for users to recognize and reference things like queries, tasks, or sessions without having to memorize or copy-paste messy strings. For example, instead of referencing a query by a random ID like 7a2b9c4d-1e3f-5g6h-7i8j-9k0l1m2n3o4p, you could use a slug like daily-sales-aggregation—way more intuitive, especially in UIs or when sharing query references with teammates.

2. Specific role of the slug parameter in QueuedStatementResource (PrestoSQL 3XX)

The slug parameter added to the QueuedStatementResource API endpoints serves a targeted purpose tied to queued queries:

  • It lets users attach a custom, meaningful label to a queued query when submitting it. This label can then be used to retrieve the status or details of that queued query later, instead of relying on the auto-generated query ID.
  • It improves observability: you can filter or search for queued queries by their slug in logs, monitoring dashboards, or admin tools, making it easier to track specific tasks (like "hourly-user-metrics-job") among a pool of queued requests.
  • Unlike auto-generated identifiers, slugs are user-controllable, so teams can standardize naming conventions for their queries to align with internal workflows.
3. Key differences between slug and token

Let’s contrast these two identifiers clearly:

  • Core purpose:
    • slug: Focuses on readability and usability for humans. It’s all about making resources easy to identify and reference manually.
    • token: Focuses on security and authorization. It’s a system-generated string used to verify that a request is legitimate and that the requester has permission to access a resource.
  • Uniqueness & control:
    • slug: May not be globally unique (depending on configuration), and is often user-defined or semi-structured. You might have multiple slugs with the same name across different contexts (like different users’ queries).
    • token: Is always globally unique, short-lived (in most cases), and fully managed by the system. Users don’t define tokens—they’re issued for authentication sessions or specific resource access.
  • Use cases:
    • slug: Used in UI displays, manual API calls to fetch queued query statuses, and organizing queries into logical groups.
    • token: Used in API request headers or parameters to authenticate requests (e.g., fetching query results, modifying session settings) and prevent unauthorized access.
  • Human-friendliness:
    • slug: Designed to be readable and memorable (e.g., weekly-inventory-report).
    • token: A random, unreadable string (e.g., eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...) that’s only meant for machine-to-machine communication.

内容的提问来源于stack exchange,提问作者Long.zhao

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 10:42:31