V
V
Vyacheslav Uspensky2015-03-25 15:25:10
PHP
Vyacheslav Uspensky, 2015-03-25 15:25:10

Which hash function to choose for query naming?

Good afternoon.
I have a wonderful class in PHP for working with parameterized Postgre prepared queries
like pgdb::getAll('query_name', 'query_text', $paramsArray);
The name of the query is, of course, useful in places, but now I'm running a rather thick and bold project with a bunch of dynamic queries, and the names interfere quite a lot in places. From here came the decision to replace (if not specified) the query name with a non-hash of the query text.
Please advise what to use? query length from simple 'select 1 from table' to monsters for 5 pages a4

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Martyanov, 2015-03-25
@Kwisatz

MD5 - fast and easy, SHA1 - less collisions.

M
Mikhail Osher, 2015-03-25
@miraage

md5 is enough.

F
FanatPHP, 2015-03-25
@FanatPHP

It's not clear why you need a query name.
I so understand, what for repeated start of already prepared request?
And how many such requests do you have for the application?
They, in fact, should not exist at all, and for those units that can be found, the game is not worth the candle.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question