

 Amazon Redshift は、パッチ 198 以降、新しい Python UDF の作成をサポートしなくなります。既存の Python UDF は、2026 年 6 月 30 日まで引き続き機能します。詳細については、[ブログ記事](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)を参照してください。

# サンプルデータベース
<a name="c_sampledb"></a>

このセクションでは、Amazon Redshift ドキュメントの例で使用されている、TICKIT というサンプルデータベースについて説明します。

この小規模のデータベースは、7 個のテーブルで構成されています。そのうち 2 個はファクトテーブル、5 個はディメンションです。「Amazon Redshift 入門ガイド」の「[ステップ 4: Amazon S3 から Amazon Redshift にデータをロードする](https://docs.aws.amazon.com/redshift/latest/gsg/rs-gsg-create-sample-db.html)」の手順に従って、TICKIT データセットをロードできます。

![\[TICKIT サンプルデータベース内の 7 つのテーブルと、それらの相互関係。\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/images/tickitdb.png)


このサンプルデータベースアプリケーションでは、アナリストが、架空の TICKIT ウェブサイトの販売アクティビティを追跡できます。ユーザーはこのサイトで、スポーツイベント、ショー、およびコンサートのチケットをオンラインで購入および販売します。アナリストは特に、長期間にわたってチケットの動向を確認でき、販売者の成功率に加えて、人気の高いイベント、施設、シーズンを確認できます。アナリストは、この情報を使用して、頻繁にサイトにアクセスする購入者および販売者にインセンティブを提供したり、新規ユーザーを誘致したり、広告やプロモーションを推進したりすることができます。

例えば、次のクエリは、2008 年に販売されたチケット数に基づき、サンディエゴで最も販売数の多かった販売者 5 名を検出します。

```
select sellerid, username, (firstname ||' '|| lastname) as name,
city, sum(qtysold)
from sales, date, users
where sales.sellerid = users.userid
and sales.dateid = date.dateid
and year = 2008
and city = 'San Diego'
group by sellerid, username, name, city
order by 5 desc
limit 5;

sellerid | username |       name        |   city    | sum
----------+----------+-------------------+-----------+-----
49977 | JJK84WTE | Julie Hanson      | San Diego |  22
19750 | AAS23BDR | Charity Zimmerman | San Diego |  21
29069 | SVL81MEQ | Axel Grant        | San Diego |  17
43632 | VAG08HKW | Griffin Dodson    | San Diego |  16
36712 | RXT40MKU | Hiram Turner      | San Diego |  14
(5 rows)
```

このガイドで例示しているデータベースには、小規模のデータセットが含まれています。このデータセットでは、2 つのファクトテーブルそれぞれに含まれる行が 200,000 行未満で、ディメンションの範囲は CATEGORY テーブルの 11 行から USERS テーブルの 50,000 行までです。

特に、このガイドに記載するデータベースの例では、Amazon Redshift テーブル設計における以下の主要機能をデモンストレーションしています。
+ データのディストリビューション
+ データのソート
+ 列指向の圧縮

TICKIT データベース内のテーブルのスキーマについては、以下のタブを選択してください。

------
#### [ CATEGORY table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/c_sampledb.html)

------
#### [ DATE table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/c_sampledb.html)

------
#### [ EVENT table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/c_sampledb.html)

------
#### [ VENUE table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/c_sampledb.html)

------
#### [ USERS table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/c_sampledb.html)

------
#### [ LISTING table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/c_sampledb.html)

------
#### [ SALES table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/c_sampledb.html)

------