Sunday, 17 February 2019
postgres tutorial 16 index
EXPLAIN SELECT * FROM address WHERE phone = '223664661973';
database engine had to scan the whole address table to look for the address because there is no index available for the phone column.
CREATE INDEX idx_address_phone ON address(phone);
EXPLAIN SELECT * FROM address WHERE phone = '223664661973';
CREATE UNIQUE INDEX idx_employees_mobile_phone
ON employees(mobile_phone);
CREATE INDEX idx_ic_last_name
ON customer(LOWER(last_name));
CREATE INDEX idx_customer_inactive
ON customer(active)
WHERE active = 0;
CREATE INDEX idx_people_names
ON people (last_name, first_name);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment