Abelisto
Abelisto

Reputation: 15614

PostgreSQL `analyse` vs `analyze`

explain analyse select true;
╔════════════════════════════════════════════════════════════════════════════════════╗
║                                     QUERY PLAN                                     ║
╠════════════════════════════════════════════════════════════════════════════════════╣
║ Result  (cost=0.00..0.01 rows=1 width=0) (actual time=0.016..0.016 rows=1 loops=1) ║
║ Planning time: 0.073 ms                                                            ║
║ Execution time: 0.109 ms                                                           ║
╚════════════════════════════════════════════════════════════════════════════════════╝

explain analyze select true;
╔════════════════════════════════════════════════════════════════════════════════════╗
║                                     QUERY PLAN                                     ║
╠════════════════════════════════════════════════════════════════════════════════════╣
║ Result  (cost=0.00..0.01 rows=1 width=0) (actual time=0.004..0.005 rows=1 loops=1) ║
║ Planning time: 0.030 ms                                                            ║
║ Execution time: 0.036 ms                                                           ║
╚════════════════════════════════════════════════════════════════════════════════════╝

Is it feature or documented function (analyse = analyze)?

Upvotes: 7

Views: 3414

Answers (1)

Sami Kuhmonen
Sami Kuhmonen

Reputation: 31153

As mentioned it's only to support British vs American English. There is no difference in functionality. Even the source code has a mention of British spelling.

There is also no difference in the timing. If you run those a million times you will not see any reasonable difference in times. Running them once may show some difference, but one is not actually faster than the other.

You can also check the parser source code. Both get parsed into exactly the same:

analyze_keyword:
        ANALYZE                                 {}
        | ANALYSE /* British */                 {}

Upvotes: 15

Related Questions