一个表无法truncate但是可以rename,这个乍听起来觉得好奇怪,下面模拟该过程。 3个session: session1执行truncate和rename操作; session2执行lock表操作; session3进行监控。 session1: [gpadmin@wx60 contrib]$ psql gtlionspsql (8.2.15)Type help for
一个表无法truncate但是可以rename,这个乍听起来觉得好奇怪,下面模拟该过程。3个session:
session1执行truncate和rename操作;
session2执行lock表操作;
session3进行监控。
session1:
[gpadmin@wx60 contrib]$ psql gtlions psql (8.2.15) Type "help" for help. gtlions=# \d test Table "public.test" Column | Type | Modifiers --------+------------------------+----------- id | integer | name | character varying(200) | Indexes: "idxtestid" btree (id) "idxtestname" btree (name) Distributed by: (id) gtlions=# select pg_backend_pid(); pg_backend_pid ---------------- 1473 (1 row) gtlions=# truncate table test; Cancel request sent ERROR: relation "test" does not exist gtlions=# alter table test rename to test1; ALTER TABLE
session2:
[gpadmin@wx60 ~]$ psql gtlions psql (8.2.15) Type "help" for help. gtlions=# select pg_backend_pid(); pg_backend_pid ---------------- 1555 (1 row) gtlions=# begin; BEGIN gtlions=# select * from test limit 10; id | name -------+------------ 19672 | 19672-asfd 19674 | 19674-asfd 19676 | 19676-asfd 19678 | 19678-asfd 19680 | 19680-asfd 19682 | 19682-asfd 19684 | 19684-asfd 19686 | 19686-asfd 19688 | 19688-asfd 19690 | 19690-asfd (10 rows) gtlions=# end; COMMIT
session3:
[gpadmin@wx60 ~]$ psql gtlions psql (8.2.15) Type "help" for help. gtlions=# select locktype,relation::regclass,pid,mode,granted,gp_segment_id from pg_locks where pid in (1473,1555) order by pid; locktype | relation | pid | mode | granted | gp_segment_id ----------+----------+-----+------+---------+--------------- (0 rows) gtlions=# select locktype,relation::regclass,pid,mode,granted,gp_segment_id from pg_locks where pid in (1473,1555) order by pid; locktype | relation | pid | mode | granted | gp_segment_id ---------------+-------------+------+-----------------+---------+--------------- relation | test | 1555 | AccessShareLock | t | -1 relation | idxtestname | 1555 | AccessShareLock | t | -1 transactionid | | 1555 | ExclusiveLock | t | -1 relation | idxtestid | 1555 | AccessShareLock | t | -1 (4 rows) gtlions=# select locktype,relation::regclass,pid,mode,granted,gp_segment_id from pg_locks where pid in (1473,1555) order by pid; locktype | relation | pid | mode | granted | gp_segment_id ---------------+-------------+------+---------------------+---------+--------------- transactionid | | 1473 | ExclusiveLock | t | -1 relation | test | 1473 | AccessExclusiveLock | f | -1 transactionid | | 1555 | ExclusiveLock | t | -1 relation | idxtestid | 1555 | AccessShareLock | t | -1 relation | idxtestname | 1555 | AccessShareLock | t | -1 relation | test | 1555 | AccessShareLock | t | -1 (6 rows)
-EOF-

この記事では、MySQLのAlter Tableステートメントを使用して、列の追加/ドロップ、テーブル/列の名前の変更、列データ型の変更など、テーブルを変更することについて説明します。

記事では、証明書の生成と検証を含むMySQL用のSSL/TLS暗号化の構成について説明します。主な問題は、セルフ署名証明書のセキュリティへの影響を使用することです。[文字カウント:159]

記事では、MySQLで大規模なデータセットを処理するための戦略について説明します。これには、パーティション化、シャード、インデックス作成、クエリ最適化などがあります。

記事では、MySQLワークベンチやPHPMyAdminなどの人気のあるMySQL GUIツールについて説明し、初心者と上級ユーザーの機能と適合性を比較します。[159文字]

この記事では、ドロップテーブルステートメントを使用してMySQLのドロップテーブルについて説明し、予防策とリスクを強調しています。これは、バックアップなしでアクションが不可逆的であることを強調し、回復方法と潜在的な生産環境の危険を詳述しています。

記事では、外部キーを使用してデータベース内の関係を表すことで、ベストプラクティス、データの完全性、および避けるべき一般的な落とし穴に焦点を当てています。

この記事では、クエリパフォーマンスを強化するために、PostgreSQL、MySQL、MongoDBなどのさまざまなデータベースでJSON列にインデックスの作成について説明します。特定のJSONパスのインデックス作成の構文と利点を説明し、サポートされているデータベースシステムをリストします。

記事では、準備されたステートメント、入力検証、および強力なパスワードポリシーを使用して、SQLインジェクションおよびブルートフォース攻撃に対するMySQLの保護について説明します。(159文字)


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

MinGW - Minimalist GNU for Windows
このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

SublimeText3 英語版
推奨: Win バージョン、コードプロンプトをサポート!

EditPlus 中国語クラック版
サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません

VSCode Windows 64 ビットのダウンロード
Microsoft によって発売された無料で強力な IDE エディター

ZendStudio 13.5.1 Mac
強力な PHP 統合開発環境

ホットトピック



