0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

SQL高速化のためのメモ書き

Last updated at Posted at 2022-09-04

SQL高速化のためのメモ記事

Like句

前方一致ではインデックス効くが、後方一致・部分一致では使用されない。

関連して、REGEXP関数はインデックスが効かないので注意。
こういうのはインデックス使われない

(SELECT * FROM テーブル WHERE カラム regexp '(^bb\\.\\*.*)|(^11.*)'));

LIKEとINを併用したいケースはどうすべきか

→OR繋ぐ
これがシンプルだがインデックスも使えて良い

(SELECT * FROM テーブル WHERE カラム like 'b%' OR カラム like '1%';
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?