What is an index for example? Correct filling of the Russian Post envelope: sample, example. How to correctly write index numbers on a postal envelope? Is the sender's or recipient's code written on the postal envelope? How to write an index in Russia

After reading numerous literature on DBMS, some experience with MongoDB and flipping through articles on databases, I had the desire to make a cheatsheet on indexes in relation to the database. And indexing is a rather interesting section of database theory, and most importantly, necessary in practice. Generally speaking, the golden rule of indexing is to have an index for every query.

By sort order

  • Ordered— indexes in which the elements of the field (column) are ordered.
    • Increasing
    • Descending
  • Disordered— indexes in which the elements are unordered.

By data source

  • Indexes by view.
  • Indexes by Expressions- for example in PostgreSQL.

By impact on data source

  • Non-clustered index- the most typical representatives of the index family. Unlike cluster ones, they do not rebuild the physical structure of the table, but only organize links to the corresponding rows. To identify the desired row in the table, a non-clustered index organizes special pointers, including: information about the identification number of the file in which the row is stored; page identification number of the relevant data; number of the searched line on the corresponding page; column contents.
  • Cluster index— The fundamental difference between a clustered index and other types of indexes is that when it is defined in a table, the physical location of the data is rebuilt in accordance with the structure of the index. The logical structure of the table in this case is more of a dictionary than an index. Data in a dictionary is physically ordered, for example alphabetically. Clustered indexes can provide significant improvements in data search performance, even compared to regular indexes. The performance improvement is especially noticeable when working with serial data.

By structure

  • B*-trees
  • B+ trees
  • B-trees
  • Hashes.

By quantitative composition

  • Simple index (index with one key)— built on one field.
    Composite (multi-key, composite) index - built on several fields. The order of the fields is important (for example in MongoDB).
    Index with included columns - A non-clustered index that additionally contains non-key columns in addition to key columns.
  • Main index (primary key index)— this is the index key under whose control the table is currently located. A table cannot be sorted by multiple index keys at the same time. However, if the same table is open simultaneously in several workspaces, then each copy of the table can have its own main index assigned.

According to content characteristics

  • Unique index— consists of many unique field values.
    A dense index (NoSQL) is an index in which every document in the indexed collection has a corresponding entry in the index, even if the document does not have an indexed field.
  • Sparse Index (NoSQL)— one in which only those documents are presented for which the indexed key has a specific value (exists).
  • Spatial index— optimized for describing geographic location. It is a multi-key index consisting of latitude and longitude.
  • Composite spatial index— an index that includes, in addition to latitude and longitude, some other metadata (for example, tags). But geographic coordinates must come first.
  • Full-text (inverted) index- a dictionary that lists all the words and indicates in what places they appear. If you have such an index, it is enough to search for the necessary words in it and then you will immediately receive a list of documents in which they appear.
  • Hash indexes— involve storing not the values ​​themselves, but their hashes, which reduces the size (and, accordingly, increases the speed of their processing) of indexes from large fields. Thus, when queries using HASH indexes, not the searched value from the field value will be compared, but the hash from the sought value with field hashes.
    Due to the non-linearity of hash functions, this index cannot be sorted by value, which makes it impossible to use greater than/less than and “is null” comparisons. In addition, since hashes are not unique, collision resolution methods are used for matching hashes.
  • Bitmap index- the bit index method is to create separate bitmaps (a sequence of 0s and 1s) for each possible column value, where each bit corresponds to a row with an indexed value, and its value equal to 1 means that the entry corresponding to the bit position contains the indexed value for that column or properties.
  • Reverse index- this is also a B-tree index but with a reversed key, used mainly for monotonically increasing values ​​(for example, an auto-incrementing identifier) ​​in OLTP systems in order to remove competition for the last leaf block of the index, because by flipping the value, two adjacent index entries end up in different index blocks. It cannot be used for range search.
  • Function-based index ( index on calculated field) — an index whose keys store the results of user functions. Functional indexes are often built on fields whose values ​​are preprocessed before comparison in the SQL command. For example, when comparing string data in a case-insensitive manner, the UPPER function is often used. Creating a functional index with the UPPER function improves the efficiency of such comparisons. In addition, a functional index can help implement any other missing type of index of a given DBMS (except, perhaps, a bit index, for example, Hash for Oracle)
  • Primary index— a unique index on the primary key field.
  • Secondary index— index on other fields (except for the primary key field).
  • XML index- A cut-out materialized representation of XML binary large objects (BLOBs) in a column with an xml data type.

By update mechanism

  • Fully rebuildable— when adding an element, the entire index is rebuilt.
  • Replenishable (balanced)— when adding elements, the index is partially rebuilt (for example, one of the branches) and periodically balanced.

By coverage of indexed content

  • Fully covering (full) index— covers the entire contents of the indexed object.
  • Partial index is an index built on a part of a table that satisfies a certain condition of the index itself. This index was created to reduce the size of the index.
  • Incremental (Delta) index— a small part of the data (delta) is indexed, usually after a certain time. Used for intensive recording. For example, the full index is rebuilt once a day, and the delta index is built every hour. Essentially this is a partial index by timestamp.
  • Real-time index— a special type of delta index in Sphinx, characterized by high construction speed. Designed for frequently changing data.

Indexes in cluster systems

  • Global index— index over the entire contents of all shards (sections).
  • Segment index— global index on the segmented key field (shard key). Used to quickly determine the segment (shard) on which data is stored during request routing in the database cluster.
  • Local index— index on the contents of only one shard.

If there are any inaccuracies or corrections, please write in the comments. I hope this “cheat sheet” will be useful to someone.

How many people wonder what a postal code is and what it is for? This digital code is most often used automatically by most people when sending parcels and letters, and when making numerous purchases over the Internet. Its importance is often realized only when, due to an incorrectly written index, a long-awaited package goes missing or an important letter takes too long to arrive.

What is it and what is it for?

A postal code is a special combination of numbers established by Russian law, which is indicated on a letter, postcard, parcel or order form. With its help, the work of the post office is optimized: the amount of manual labor is minimized, sorting efficiency is increased, delivery is accelerated, the risk of errors when moving parcels and letters is reduced, and the likelihood that the mail will reach the correct addressee increases.

Indexes are written in special angular numbers; this format is easier to read by computers. For the convenience of the sender, letters and forms contain examples of writing numbers, as well as a form of thin dotted lines. Therefore, to fill out this column you do not need special skills, just accuracy and attentiveness. It must be remembered that an error or lack of an index can lead to the loss of the shipment or its severe delay. Numbers can be written in ink of any color, excluding green, red and yellow.

Story

At all times, people exchanged messages. Life sometimes depended on the speed and accuracy of information transfer. Signal lights, fleet-footed messengers, dogs, birds, passing caravans and ships were used. The Persians formed lines of thousands of people, placing them within earshot. Using roll call, messages were transmitted over long distances. Carrier pigeons were particularly accurate, with a phenomenal ability to find their home.

An evolutionary leap forward was the introduction of the telegraph in the first half of the 19th century. But he still could not cope with the information flow of rapidly developing humanity. The postal services could not cope with it either; they needed obvious improvements. The invention of the postal code helped cope with the growing volumes of letters and parcels. This elegant solution streamlined the work of mail, and over time played a role in its automation.

Indexation in Russia

Postal indexing first appeared in the USSR in 1932. Experimental use of the index began in Soviet Ukraine and continued successfully until 1939, when World War II broke out. The indices were canceled, apparently for national security reasons.

For the second time they began to be used throughout the Soviet Union. In 1971, a global indexation of the entire country was carried out. Numbers were assigned to each post office. From now on, the sender was required to indicate a digital index on every parcel, greeting card or letter. This was done largely due to the fact that postal services began to use advanced machines at that time to process items.

How is it decrypted?

In the form in which the index is used now, it was approved in 1998. Postal divisions in our country correspond to administrative divisions. Today, the Russian postal code is a natural sequence of six digits, format AAAABBB. AAA is a numeric code that is assigned to cities of republican, regional or regional significance. Large federal subjects and megacities have several codes. BBB is a numeric code that is assigned to each post office in a particular city.

For illustration. The following information is encrypted in the index 414042: 414 - Astrakhan city code, 042 - post office No. 42, which is located on Bumazhnikov Avenue and serves houses in the district. Other examples: 685007, 685 - Magadan code, 007 - post office No. 7, serving houses on Ammonalnaya Street; 241027, 241 - Bryansk code, 027 - post office serving buildings on K. Marx Square.

How to find out postal code?

In our age of the developed Internet, this is easy to do. There are three common ways to determine a zip code.

  1. First. Call or go to the post office. This method is suitable if you need to find out the index of a specific branch that is located nearby. However, at the post office, employees will give information about any address, because they have the corresponding directories.
  2. Second. Use the help program. A convenient and detailed program is 2GIS. With its help, you can quickly determine the address of almost any building in Russia. To find out what the postal code is for the desired house, you just need to find it on the map and click on it.
  3. Third. The easiest and fastest way is to use any Internet search engine to find a directory indicating all Russian postal codes. The main thing is to find a recent reference book. The fact is that there are a lot of indexes; changes are constantly taking place in their database, which are not significant, but it is still advisable to use the most up-to-date information to eliminate errors.

And remember that the index must always be specified. This affects the speed of delivery of the item.

The address must be written legibly.

The recipient's address must be written in the lower right corner of the item. The sender's address is in the upper left.

The address indicates:

  • Full name of the recipient (in the format “Last Name First Name Patronymic”) or name of the organization (short or full)
  • Street name, house number, apartment number
  • Name of the locality
  • Name of district, region, region or republic
  • The name of the country
  • PO Box number, if available (in the format “PO Box 15”)
  • Postal code according to the example:

Stamps must be affixed to the upper right corner of the address side of the envelope, postcard, or package. If this corner is occupied, place the stamps a little lower.

Sometimes the stamp may be printed directly on the envelope or card.

The letter A applied to the envelope allows you to send a simple letter within Russia weighing up to 20 g without gluing additional stamps.

Printed on the envelope letter D allows you to send a registered letter within Russia weighing up to 20 g without affixing additional stamps.

Printed on a postcard letter B allows you to send this postcard throughout Russia without adding additional stamps.

Having added stamps for the required amount, you can send postcards and envelopes with the letters A, B and D abroad.

Everyone at least once in their life has come across the concept of stock indices or, at least, heard that “the RTS and MICEX indices have updated their maximum since April.” But what is hidden behind this concept, and why are stock indices needed at all? Today we will take a closer look at this issue.

What is an index

A stock index is an indicator of price changes for a certain group of securities. You can imagine a stock index as a “basket” of shares united according to some characteristic.

The most important thing when studying an index is what stocks or bonds it is formed from. It is the set of securities included in the list on the basis of which the index is calculated that determines what information can be obtained by observing the dynamics of this index.

Why are indexes needed?

In general, the main purpose of compiling a stock index is to create an indicator with which investors could characterize the general direction and “speed” of movement of stock quotes of companies in a certain industry.

Studying the dynamics of indices helps participants in exchange trading understand the impact of certain events on quotes - if, for example, an increase in oil prices occurs, then it is logical to expect an increase in the quotes of all oil companies. However, shares of different companies grow at different rates (and some may not grow at all) - the index helps to understand the general trend of a market segment without the need to assess the position of many disparate companies.

Comparing indices with each other gives an understanding of how different sectors of the economy are traded on the market in comparison with each other.

A little history

The first widely used index was the index created by Charles Dow in 1884. Its calculation was based on quotes from the 11 largest (and with the largest share turnover on the stock exchange) US transport companies at that time - the index was called the Dow Jones Transportation Average. In 1896, the index that is today known as the Dow Jones Industrial Average appeared, which united America's major industrial companies.

The word “industrial” in today’s realities is nothing more than a tribute to tradition, since the indicator itself has long included companies that are not directly related to this industry.

Index Manufacturers
Another way to classify indices is by compiler distribution. Indices can be “agency” when they are calculated by special agencies (for example, the S&P indices of the Standard & Poor’s agency). The second option is stock indices created, in fact, by stock exchanges. In the USA this is NASDAQ, and in Russia the two main stock indices were calculated by the MICEX and RTS exchanges, which have now merged into a single “Moscow Exchange”.

In addition, a brokerage company can also compile indexes. For example, ITinvest calculates its own indices, among which there are, for example, correlation indices (futures on the RTS index and the MICEX index, futures on the RTS index and the S&P 500 index), which are used for trading futures on the RTS index, “glued” futures and others indicators.

What do the indices show?

The list of stocks whose quotes are used to construct the index is formed according to certain criteria, depending on the purpose of compiling a specific index.

The method of calculating indices implies the inclusion of financial instruments that have similar characteristics. In particular, the share capital of companies whose shares are included in the index should not differ by orders of magnitude.

In general, it is believed that the movement of stock prices of well-known and large companies also reflects the dynamics of trading in smaller financial instruments from the same industry (this is an important clarification). Industry stock indices are needed to create hypotheses about the dynamics of price movements of different companies in the same industry, even those not included in the index itself. Accordingly, industry indices help investors assess the prospects of investing in companies in a particular sector of the economy at a particular point in time.

Examples of industry indices can be well illustrated by the Dow Jones family, which includes:

  • DJIA Industrial Index - is calculated based on the stock prices of the 30 largest companies from leading US industries.
  • DJTA Transportation Index - covers shares of the 20 largest American transportation companies.
  • Utility index DJUA - shares of 15 companies in the electricity and gas supply sector. engaged in gas and electricity supply.
There is also a composite index (DJCA - Dow Jones Composite Average) - an indicator based on the values ​​of the three previous indices.

There are also specialized exchanges for companies united on one or another basis. For example, the NASDAQ exchange of high-tech companies in the USA.

Often, indices are compiled on a regional basis - for example, you can compile lists of shares of companies representing a certain country or group of countries (for example, the European Union or blocs such as BRIC). Similar to industry indices, these indicators help investors better understand the state of affairs in the markets of specific regions and countries,

An example of a regional index is the Morgan Stanley Capital International family of indexes (famous among MSCI investors). MSCI country indices are calculated based on shares of companies in a specific country. There are also indices for individual markets - developed and emerging. For example, the MDCI Developed Market Index includes shares of companies from 24 countries in which stock markets are recognized as developed, and the MSCI Emerging Market Index, accordingly, includes shares of companies from 27 countries that are classified as developing.

Current events

At the end of last week, information appeared in many business media that the world's leading index providers are planning to exclude Russian companies from their own indices. In particular, as Vedomosti reported, one of the most famous index compilers, MSCI, announced the launch of a number of new indexes that do not include Russia. This was done in order to help investors avoid investing in a country that is under sanctions from the European Union and the United States.

Another major provider, S&P Dow Jones, also announced that it is conducting consultations on the possible exclusion of Russian companies.

Experts interviewed by Vedomosti generally consider such a decision to be a blow for the Russian economy, since under the current conditions investors will not invest in domestic companies.

However, ITinvest chief economist Sergei Yegishyants is convinced that not everything is so scary:

There is only one meaning [of such sanctions] - a certain number of Western investment funds invest money not in some specially selected shares, but in some index, where the developers have driven companies based on a certain criterion (industry, geography, economic status, etc.) “Buying” such an index means, in essence, purchasing shares of all companies included in it in the proportion that is established for them by the index manufacturer. Accordingly, the exclusion of corporations from it means that now these “index” funds are no longer buying shares of these corporations, or even selling off those that they already owned.

Those. for our stock market, this is simply another wave of flight of foreign money - and this time purely speculative (i.e. not participating in processes in the real economy): of course, this is unpleasant (the market is falling - although not much, because there is no such money here anymore so much) - but in principle it’s even good, since the less “hot” global money, the smaller the amplitude of market fluctuations during various shocks.

The economy does not suffer at all from such somersaults - in the sense, it is simply not affected by these inflows and outflows: they all pass by the real sector - and only the fall in the turnover of financial sector companies can somehow be considered a negative consequence for the national economy.

It’s just that in recent years, the share of this sector in the overall GDP growth has been very large - it is in the lead by a wide margin: another thing is that these are mainly not brokers, but banks, distributing an insane amount of consumer loans - although this process is already being phased out. In general, nothing bad happened.

How to use indexes

In general, the existence of an index serves several purposes. They can be used for:
  • Obtaining an idea of ​​the general dynamics of stock prices of a certain group (companies, countries, industries, etc.). Often this data is used to make speculative transactions.
  • There are derivative instruments that are based on the index itself - for example, there is a futures contract on the RTS index. Most often, such contracts are used to hedge risks (more details in our