I want to make my table schema better. This table will insert a record per microsecond.
The table is already too big, so I could not test the table itself.
Current setup (columns id
, name
, one
, two
, three
):
SELECT *
FROM table
WHERE name = 'foo'
AND one = 1
AND two = 2
AND three = 3;
Maybe in the future (columns id
, name
, path
):
SELECT *
FROM table
WHERE
name = 'foo'
AND path = '1/2/3';
If I change three integer
columns to one varchar
column, will the SQL run faster than now?
Using PostgreSQL
varchar
length will 5~12. I think I can usebigint
withzerofill
(1/2/3
to1000010200003
) which may be faster than varchar.