- 论坛徽章:
- 0
|
补充下,只有部分记录有这样的现象,其他记录用'='和'like'结果是一样的.
对于username字段,我加了索引,如:
ids=# \d user_activity
Table "public.user_activity"
Column | Type | Modifiers
-------------+------------------------+------------------------------------------------------------
id | bigint | not null default nextval('user_activity_id_seq'::regclass)
devid | bigint | not null
ipaddr | bigint | not null
username | character varying(256) | not null
domainname | character varying(256) |
dcname | character varying(256) |
hostname | character varying(256) |
serverip | bigint | default 0
servername | character varying(256) | default ''::character varying
logontime | bigint | default 0
logofftime | bigint | default 0
logontype | bigint | default 0
session | character varying(256) | default ''::character varying
lastacttime | bigint | default 0
lastupdtime | bigint | default 0
errorcode | bigint | default 0
Indexes:
"user_activity_pkey" PRIMARY KEY, btree (id)
"uact_idx_useriplogonsess" UNIQUE, btree (ipaddr, username, logontime DESC, session)
"uact_idx_lastupdtime" btree (lastupdtime)
"uact_idx_logofflogonip" btree (logofftime, logontime, ipaddr)
"uact_idx_logon" btree (logontime)
"uact_idx_user" hash (username) <<<<<<<<<<<<<<<<<<
当我DROP掉"uact_idx_user"后就正常了,所以想知道HASH的时候是用username字段的256个字符做还是用username中的字符串('\0'结尾)来做?
如果是前一种方式的话就可以解释了~~
请熟悉其中细节的大牛赐教啊~~ |
|