Sql/Add Index Before Select
Codemod verified
Regularly tested and maintained by our engineers and codemod expert community.
Example of using codemod that changes SQL.
It detects all SELECT statements and adds an index creation statement before them.
Inside SELECT statement for any fields that ends with _id
it creates an index on that field.
Example
Before
select * FROM orders WHERE customer_id = 123;
After
CREATE INDEX idx_customer_id ON orders(customer_id);SELECT * FROM orders WHERE customer_id = 123;
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community