At Raymond Hettingers Pycon 2017 Talk, What is Database View

In Raymond Hettinger Talk, he shows a view for a database index. Below is shown

[None, 4, None, 1, None, None, 0, None, 2, None, 3, None, None, None,None]

I think he explains this later in the conversation, but I am having problems with parting.

So far I get that it contains indexes for the table, what is this array and how is it generated? What does he represent? To be really specific, what does 4 represent in the 1st position in the list (2nd, if there was no zero indexing) of the list?

Screenshot Discussion Pycon Video Link

+4
source share
1 answer

, , Python. .

:

Row Number  Name       Color     City        Fruit
----------  --------   --------  ---------   -------
0           'guido',   'blue',   'austin',   'apple'
1           'sarah',   'orange', 'dallas',   'banana'
2           'barry',   'green',  'tuscon',   'orange'
3           'rachel',  'yellow', 'reno',     'pear'
4           'tim',     'red',    'portland', 'peach'

, ( ).

, ( ).

, . , O(log n) bisection:

Name      Row Number
--------  ----------
'barry'   2
'guido'   0
'rachel'  3
'sarah'   1
'tim'     4

Python ​​ :

[2, 0, 3, 1, 4]

, ( ).

- . , O(1) :

Hash   Name      Row Number
----   --------  ----------
0      -         -
1      'tim'     4
2      -         -
3      'sarah'   1
4      -         -
5      -         -
6      'guido'   0
7      -         -
8      'barry'   2
9      -         -
10     'rachel'  3
11     -         -
12     -         -
13     -         -
14     -         -
15     -         -

Python ​​ , None :

[None, 4, None, 1, None, None, 0, None, 2,
 None, 3, None, None, None, None, None]

- , 16 ( 16) . .

, , , , "" .

, Python 3.6 / , . ( , ). . O(1). .

. , , Python . , - , .

, .

+5

Source: https://habr.com/ru/post/1677885/


All Articles