Skip to content

dongwooklee96/faiss_example

Repository files navigation

CREATE INDEX AND QUERY


SELECT VERSION();
CREATE TABLE image_vectors (id bigserial PRIMARY KEY, img_path varchar, embedding vector(1536));


CREATE INDEX ON image_vectors USING ivfflat (embedding vector_l2_ops) WITH (lists = 1000);

EXPLAIN ANALYZE
select *
from image_vectors ORDER BY embedding <->
                            '[0.17478834,0.09658005,0.3441968,0.65637535,0.02479817,0.4235437,0.31104344,0.100507334,0.34315062,0.23608986,0.061479963,0.28164393,0.12073515,0.49350297,0.0194497,0.21404283,0.08841528,0.49767393,0.079618275,0.13545874,1.5153108,0.3122746,0.96747136,0.93397653,0.17399317,0.55619776,0.06441897,0.19688414,0.10056488,0.15618125,0.24855503,0.13620669,0.7417189,0.18517189,0.19693804,0.09864161,0.31831187,0.46400037,2.1319275,0.1940088,0.23400235,0.011516441,0.3472342,0.42542782,0.022702016,0.038691003,0.53458905,0.96655756,1.8759983,0.5986636,0.011502389,0.23750518,0.5329718,1.042056,0.37065637,0.3585275,0.09873975,0.3257072,0.49286672,1.5263789,1.1356518,0.22365615,0.19471286,0.10301998,0.15482399,0.664276,0.043788422,0.21873823,1.0346378,0.40524504,0.19227046,0.5085118,1.1318845,0.07739415,0.22668973,0.7913865,0.81533176,1.5283496,1.4049718,1.0003405,0.16613938,0.15359917,1.2021298,0.43919045,0.08969064,0.84387064,0.2633226,0.9847844,0.017939989,0.11236505,0.006627624,0.5836958,0.49700746,0.7931905,0.33033168,0.105872706,0.06686962,0.98358,0.54005736,1.1958373,0.5183825,0.134165,0.582796,2.1662064,0.44900075,1.3192201,0.013724165,0.24006014,0.41143358,0.05768417,0.51587075,0.35192308,0.7864557,0.23989266,1.1876175,0.13020593,0.020652253,0.453282,0.462147,0.82100827,0.059403233,0.1287801,0.43966746,0.593162,1.1923633,0.7789526,0.051417656,0.46886754,0.23290543,1.1509565,0.26555705,0.08377724,0.40805244,0.03221679,0.19957648,0.19938299,0.3217607,0.062556244,0.91804725,0.21567102,0.17660989,0.88247484,0.059945658,0.16255751,0.46592692,1.3016843,0.55864197,0.057581134,0.23330817,0.10441683,0.8002732,0.13674757,0.33686313,0.14766483,0.07737238,0.49621692,0.7152902,0.37129232,0.33218315,0.21576592,0.28488934,0.075363964,0.57276976,0.45541334,0.21828629,0.11206319,0.024690632,0.6377184,0.19880216,0.19387802,0.016741527,0.13873076,0.6420416,0.41498393,0.39013526,0.254067,0.5452386,0.26194093,0.44483054,0.05017662,0.14134213,0.061452765,0.44391617,0.32911146,0.7167866,0.32246983,0.29356623,0.29448086,0.17347392,0.0497484,0.48727483,0.5337885,0.1088075,0.050857864,0.25825393,0.20655832,0.8019223,0.58127314,0.3732884,0.31739196,0.49617344,1.2982116,0.0289387,0.48762968,0.29379985,0.47998238,0.14447716,0.06513884,0.05852317,1.4685183,0.19173932,0.58955765,0.59964824,0.07050321,0.7273582,0.37356108,0.32329172,0.029024016,0.26139402,0.23625496,0.57374406,0.34366435,0.034578003,0.75420463,0.39582998,0.89508176,0.20757787,2.627505,0.06396965,0.47249913,0.5094552,0.55152285,0.052945413,0.09940605,0.14213195,1.0058873,0.013071733,0.31013876,0.23029536,0.5119051,0.045210585,0.39301696,0.69264686,0.8016839,0.004921404,0.29651594,0.7594704,0.5502429,0.12559626,0.92439383,0.28419068,0.32752576,0.22710937,0.9494035,0.28226086,0.247492,0.12753865,0.61108303,0.089178786,0.568182,0.025630897,0.74843043,0.44746897,0.2969175,0.12817818,0.43259034,0.053768218,0,0.6183423,0.2042042,0.30967602,0.031604562,0.37367743,0.32307014,0.6700897,0.07367146,0.09773651,0.25758573,1.0373983,0.14379182,1.085645,1.2186518,0.5903957,0.31986353,0.1855853,2.2095547,0.30891827,0.5053319,0.42391264,1.3522825,1.0477839,0.57434106,0.88010997,0.055909023,0.45020828,0.06261478,0.82398015,0.206361,0.61720634,0.052018985,0.5085022,0.10056932,0.028128892,0.13263856,1.2834753,0.43823642,0.18021756,0.4020134,0.038235605,0.063079685,0.38861036,0.21281551,0.33777308,0.3876641,0.28328386,0.07138997,1.2046798,0.09443081,0.6670481,0.10925099,0.021185433,0.32645908,0.24177775,0.15598378,0.03755415,0.30043614,0.083415195,1.0382248,0.075061545,0.3823316,0.37060595,0.03932906,0.5377438,0.6830022,0.33371213,0.9797931,1.2486656,0.095372826,0.987537,0.24908993,0.064131625,0.15566105,0.5751867,1.0925901,0.5776923,0.90700567,0.48359406,0.68690026,0.29721707,0.17002064,0.43444306,0.4320205,0.5232548,1.1806256,0.87580055,0.8758116,0.26670018,0.37485278,0.32341287,0.08646512,0.40825057,0.15170291,0.39355835,0.6355306,0.36770526,0.61410254,0.22628504,0.86368155,0.5188261,0.18406661,0.37476194,0.07792997,0.26083612,0.77422696,1.2762008,1.068974,0.22675776,0.99904567,0.373618,0.6141043,0.3473768,0.12951998,0.004114012,0.0895013,0.33593944,0.048967436,0.4054934,0.030715816,0.521098,0.027929973,0.119986124,0.20908037,2.148808,0.107304804,0.6730111,0.44381124,1.6487828,0.46392217,1.1259007,1.709695,0.23098104,1.3529252,0.14976239,0.27277213,0.01847606,0.29196915,0.42020556,0.756167,0.5122801,0.25326562,0.07156336,0.32126415,0.30064228,0.008503681,0.40256956,0.78513706,0.015307816,0.35535043,0.117601916,0.7164353,0.878052,1.167278,0.5949353,0.732312,1.4614934,0.16845697,0.38258684,0.79392946,0.22798541,0.07311509,1.68794,0.55368435,0.4894571,0.24091086,0.03161701,0.364546,0.38893586,0.035732992,0.37981316,1.1601915,0.6863933,0.69537103,0.13437839,0.5446576,0.10585479,0.028278638,0.06063839,0.70258975,0.42286772,0.6871892,0.4155402,0.2440737,0.06590368,0.5707597,0.63859946,0.4706799,0.18577906,0.055606592,0.038383428,0.9894361,1.3877743,0.27572113,0.17736647,0.37511867,0.64882815,0.46710384,0.10697012,1.3088212,0.29194832,0.048958074,0.47581372,0.07837947,0.09707473,1.2213331,0.10035863,0.04400669,0.3179882,0.5961565,0.14077362,0.020172477,0.63162524,0.8844842,0.33066624,1.019652,0.7172754,0.7269143,0.6774996,0.33791506,0.07820125,1.5211593,0.9862429,1.3400189,0.33975282,1.0267133,0.11568172,0.6070341,0.15851161,0.02650172,0.49934784,0.37038314,0.46204233,0.17019194,0.13028036,0.65163004,0.17617431,0.6240704,0.42957407,0.17922646,0.48194602,0.10975692,0.37654713,1.0919484,0.50296503,0.1283401,0.2477522,0.15477285,0.09210208,0.08428878,0.17571479,1.2670424,0.32081762,0.019041682,0.5518848,1.0813615,0.060804974,1.4807305,0.20329747,0.8692627,0.33589426,0.33997738,0.39527106,0.38281235,0.09163667,0.05406063,0.035929225,0.4665749,0.6733061,0.12330714,0.50946593,1.1279324,0.08365212,0.2657475,0.21015854,0.39618713,0.71138215,0.012188539,0.37511167,0.23207189,1.2827327,0.010902755,0.46177492,0.28494662,0.58051026,0.9028576,0.36654776,0.4830105,0.6542553,0.15175197,0.80531955,0.18430242,0.37563097,1.7733122,0.32254958,0.16883487,0.37016806,0.17826512,0.68269384,0.8804823,0.24096565,0.11858648,0.6953462,0.105633624,0.47466058,2.2243428,0.079977326,0.81308764,0.040429235,0.8630364,0.15218395,0.39350206,0.13351806,0.3000942,0.16845202,0.9912094,1.1106658,0.09018269,1.0843577,0.019565921,0.46651784,0.09396784,0.78251797,0.14664188,0.6762273,0.5652528,0.06980665,0.48767954,0.88658303,1.0524379,0.19630346,0.08328748,1.6715512,0.09167749,0.3536317,0.24911916,0.087593116,0.07451737,1.0388355,0.10062664,0.101798676,0.039641842,0.07359249,0.3243928,0.32565746,0.39005515,0.027771821,0.43021297,0.32091823,0.23527053,1.9315526,0.19555333,1.0924854,0.22278744,0.14631404,0.10015388,0.0051016808,0.9735214,0.41756308,0.17404151,0.22139476,0.81484556,0.25848204,0.27275243,0.050448123,0.99303275,0.08774729,0.4302315,0.6170507,0.07485969,0.15716267,1.3461268,0.21268846,0.32551903,0.055283345,0.27493918,0.5914705,0.3664535,0.78737205,0.5795637,0.87253255,0.028608896,0.12992287,0.46155486,0.8910592,0.2233614,0.6473764,0.12150909,0.192808,0.7266058,0.047377344,0.09536956,0.00453712,0.81219,0.19456568,0.37062728,1.3812563,0.48175707,0.095804274,0.5220213,0.23389712,0.21412988,0.43990687,0.41157323,0.24271905,0.23361167,0.58805645,0.10117093,0.06319918,0.090064146,1.10733,0.34244606,0.94412696,0.80544025,1.8830299,0.36479723,0.062217664,0.7994684,0.35193282,0.20336595,0.43994483,0.8868759,0.9401608,0.60023415,0.16141942,0.9879036,1.2508652,0.23822811,0.72445285,0.014286391,0.40407687,0.2630315,0.8113315,0.2782696,0.20364729,0.48081505,0.025070196,0.63645697,0.0031236853,0.56715757,0.11201027,0.6682679,0.41262275,0.0020329126,0.34734857,0.6677065,0.13258716,0.044632923,0.8657377,0.24925981,0.25591034,0.33525422,1.2406671,0.032298367,0.7544779,0.13861418,0.0066114757,0.03321565,0.12788747,0.4308496,0.069209285,0.7654642,0.3310726,0.2531004,0.21413252,1.851303,0.012209206,0.6596665,0.1877304,0.88643396,0.13345405,1.459447,1.2184137,0.81303,0.74288666,0.31135723,0.48662856,0.11671901,0.27375627,0.42386162,1.5333989,0.5492405,0.08723033,0.38589105,0.46157813,0.5507159,0.23245603,0.33733752,0.47194496,1.213538,0.04419006,0.40299612,0.34473568,0.64199317,0.25278524,0.022254705,1.0552323,0.02766151,0.1724011,0.5940692,0.6016859,0.3892986,0.14724872,0.21066433,0.53748685,0.44343752,0.100837514,0.42446446,0.45588434,0.71813154,0.80387163,0.29436484,0.1580183,0.16038503,0.4783351,0.42398503,0.18823415,0.10506567,0.55355763,1.2836004,0.1854282,0.2735016,0.14295474,0.6185795,0.93001246,0.18068591,1.3666304,0.021831986,0.0066162227,0.62112397,0.02691409,0.07652367,0.34913287,0.021922719,0.616293,0.1808821,0.9631695,0.11240032,0.14899735,0.13046321,1.8398645,0.86148614,0.32105386,0.072415784,0.26280415,1.8362591,0.17282607,0.111270696,0.039826207,0.9322909,0.6021545,0.13581093,0.25250295,0.2781089,0.51410687,0.39912924,1.0598245,0.815122,0.4125297,0.029028224,0.5599466,0.04410023,0.6228065,0.22414652,0.13184664,0.5732944,1.0859563,1.1507503,0.037283223,0.5270262,0.56286573,0.0074330173,0.4170774,0.29790425,0.13899559,0.5610298,1.1168664,0.44683367,0.02093295,0.41832048,0.526904,0.5215619,1.5484672,0.19331047,0.18941025,0.25638536,0.41778737,0,0.018322036,0.5333821,1.0529413,0.12450087,0.29817066,1.0060663,0.63147676,0.49890137,0.05712623,1.0096151,0.4594545,0.05705773,0.062089667,0.9033102,1.3199509,0.82601595,0.7400485,0.037097573,0.16063908,2.377339,1.3934944,0.33558148,0.39598796,0.7328408,0.18295556,0.44648752,0.072379485,0.42312306,0.7033821,0.3422363,0.26974088,1.1194489,0.9319738,0.16951597,0.3941229,0.43369767,0.4585474,0.59580845,1.6073198,0.42829514,0.109451786,0.14582318,0.95797366,0.020498311,0.3601042,0.14964923,0.8439428,0.5317028,1.124675,0.2995594,0.94829166,0.05611538,1.2705061,0.41739973,0.7460285,0.8379057,0.38086998,0.27011397,0.051749572,0.1781718,0.6835059,0.65196687,0.23842831,0.5686667,0.16988191,1.5205331,0.07157558,0.8975104,0.2953582,0.75893164,0.17745435,0.35427338,0.5570857,1.438134,0.16807088,0.6217096,0.11182106,0.017702542,0.632602,0.264558,0.27238786,0.15014723,0.22009058,0.5997211,0.9463835,0.30867016,1.10853,0.5275204,0.015270816,0.38422203,0.6704851,1.0850223,0.07915289,0.31318825,0.9511353,0.9268141,0.44603997,0.37688068,0.18420786,0.17161593,0.105362594,0.056679077,0.42040962,0.5115801,0.40062582,1.5334121,0.25616595,0.6955655,0.15040185,1.4199828,0.39430943,0.21970315,0.3195971,0.10815711,0.4395097,1.2200081,1.0868018,0.7008511,0.2650257,0.07126784,0.24439079,0.1600653,0.16488618,0.015143794,0.24151313,1.5445334,0.98704445,1.5888294,0.14936693,0.2215899,1.0799026,0.16541098,0.47472882,0.14464316,0.12798443,0.2171532,1.2038374,0.40641782,0.29682687,0.38067368,0.4972129,0.048664205,0.28458416,0.09762138,0.43303552,0.5388124,0.11630964,0.25321585,0.21763247,0.08737509,0.07770267,0.8504433,0.31813318,0.5931231,0.13876061,0.16294503,0.36136565,0.7100054,0.5647152,0.74851155,0.05322446,0.19706604,0.5397869,0.71774685,0.13979205,0.6662595,0.8018333,0.22693458,0.010594392,0.18499847,0.30143487,0.5492108,0.44542858,0.16168758,0.80915135,0.15708198,0.12819059,0.13581678,1.2174878,0.36026978,0.85158885,0.85517585,0.005070384,0.5191638,0.74991226,0.9070393,0.37428927,0.27091601,0.25177458,0.47034037,1.1730044,0.79798573,0.49344915,0.2814394,0.6594265,0.50168395,0.3989185,0.3245172,0.4699267,0.2720803,1.6096027,0.9525099,2.249195,0.17948954,1.0241781,0.8711987,0.8366251,0.03800314,0.027849179,1.24528,0.052429594,0.55514526,0.41800866,0.9649031,0.122889385,0.35802662,0.105330296,0.18252945,0.056896776,1.2042519,0,1.0520484,0.32438302,0.36626443,0.46115,0.44159773,0.42147085,0.14095183,0.45792544,0.112859696,1.0300282,0.39014184,0.20051625,1.4350562,0.66887057,0.3663962,0.11958619,0.014052045,0.74608403,0.4634006,1.0828122,0.92126906,0.49819863,0.2116858,1.0788635,0.072806135,0.67599773,0.020425893,0.7545479,0.10523921,0.5822604,0.008543948,0.12974429,1.2401285,0.26190612,0.7418673,0.6981843,0.15611419,1.0491662,0.7720928,0.23372334,0.8293149,0.21039316,1.0917627,1.3853769,0.85462284,0.63650274,0.27138048,0.28882045,1.3031824,0.49868098,0.18190467,0.2886994,0.3120183,1.0027409,0.57304245,0.03318174,0.02302425,0.007866246,0.41397166,1.1184112,1.3359447,0.41592652,0.12283875,1.2978429,0.74753994,0.25048894,0.5786397,0.065742016,0.37425762,0.2526994,0.37684923,0.37540594,0.9053173,0.36767888,0.17508782,0.016954135,0.21877371,0.14777547,1.0403023,0.2432259,0.019932263,0.34768108,0.74995315,0.5003304,0.53496015,0.23150545,0.9626272,0.96725285,0.069350734,0.22139436,0.14462954,0.20348853,0.20830224,1.0848289,0.06703418,0.5622769,1.4410508,0.0034639458,1.0415155,1.519775,0.99819744,0.0047419104,0.12984198,0.19433877,0.5181993,0.2575951,0.58948207,0.08743649,0.12372518,1.0450433,0.5802001,0.26671556,0.07611311,0.30446318,0.4753796,0.28058824,0.20855632,0.06384216,0.034666643,0.33052835,0.3649505,0.97330356,0.569557,0.7385273,1.2611502,0.21872649,0.21629244,0.09315147,0.457287,0.93599486,0.07310934,0.36072794,0.05304661,0.40273365,0.10452259,0.31180605,0.5132047,0.46187356,1.0043186,0.14098443,0.03893417,0.005484748,0.08204821,0.26412022,0.009717511,0.5414736,0.96210206,1.1868597,0.26918405,0.11750403,0.31374347,0.28354585,0.20404187,0.72652847,0.4463226,1.342819,0.018171951,0.45295876,0.5623921,0.18361211,0.367436,0.22244196,0.5743944,0.5737303,0.48283696,0.37853444,0.6019411,0.04830232,0.6839967,0.42095357,0.55219895,0.31448463,0.54236275,0.30347708,0.037218563,0.657294,1.0528034,0.16898555,0.25859004,0.49550712,0.092165805,0.52729994,1.0413448,0.15907209,0.38275725,1.8257167,0.36500856,0.055534624,0.010483537,0.3011886,0.022607058,0.1400944,0.10021525,0.54348737,0.35686585,0.24744835,0.09650331,0.26466876,0.5354636,0.25317177,0.6040231,0.4391104,1.0056784,0.44367862,0.47773695,0.26428634,0.1986,0.450348,0.2733931,0.6222919,0.0106844455,0.5964204,0.084013075,2.2327945,0.87379456,0.7135734,0.11226275,0.24257897,0.36575732,0.10114788,0.055859994,0.44574112,0.017472146,0.9783286,0.4160398,0.3061134,0.21330269,0.1638351,0.3764406,0.10225032,0.32500938,0.13148081,0.6107024,0.09054744,0.2234124,0.023722542,0.35387808,0.75608116,0.96291447,0.06150368,0.06891417,0.05544192,0.7171282,0.69446707,0.03172368,0.26642266,0.47277802,0.6908735,0.36535752,0.16024171,0.7003485,0.064799145,1.2512342,0.1962721,0.18380037,0.17191033,0.8454499,0.16662604,0.82952535,0.4502011,0.1848827,0.003426867,0.17811267,0.15393649,0,0.05380509,0.5164201,0.6242022,1.503494,0.13583228,0.07983888,1.3833281,1.0515103,0.0375977,0.61349046,1.1602266,0.6148273,0.26811677,0.069007985,0.8698697,0.3044149,0.4469415,0.26853952,0.3244513,0.09688574,0.94855815,0.80430305,1.2653263,1.6057317,0.06368557,0.17395827,0.24887967,0.4467057,0,0.67537296,1.3164785,0.47064036,0.8497998,0.34554002,0.37917295,1.103784,0.1407725,0.6510001,1.1766162,0.37826222,1.0601181,0.27088475,0.54445744,0.072717205,0.3263292,0.027774865,0.36864406,0.44838303,0.53424144,0.2679423,0.93277514,0.3488766,0.05806142,0.50300246,0.0447979,0.0047732126,2.1211743,0.6004252,0.43197626,0.707393,0.12240496,0.48827887,1.0710737,0.67806077,0.16707858,0.071726464,0.90468884,0.32653445,0.7975638,0.60950565,1.1515408,0.03724839,0.66454875,0.21804713,0.6602616,0.24392338,0.5488984,0.14948249,0.44088846,0.065528266,0.34072608,0.57465905,0.032904327,0.4393075,0.64730936,0.376975,0.8161346,0.457358,2.1510112,0.22661307,0.7569964,0.34152997,0.12783393,0.2212684,0.27228102,0.4226622,0.34385282,0.12359193,0.6399702,1.2190821,0.3938421,0.43364385,0.29565006,0.030834293,0.35679582,0.29316664,0.61209905,0.35437354,0.7908875,1.2575902,0.15825121,0.1594485,0.09006314,0.50574565,0.19936126,0.62313646,0.08269557,0.54415435,0.4252063,0.83253086,0.47983485,0.042671736,0.6939085,0.6293062,0.34454378,1.2505722,0.5919902,0.20936874,0.71306336,0.36130884,0.2623835,0.08823161,0.76977485,0.8728361,0.50407803,1.3752036,1.0162566,1.2204546,0.31639796,0.24711998,0.16203247,0.18776661,0.60271823,0.8243725,0.29530486,1.4713857,0.096160725,0.083017156,0.008118946,0.054735493,0.43300736,0.166771,0.37933096,0.59562415,0.32207566,0.46441767,0.55491024,0.062434655,0.57822245,0.38505653,0.4388203,0.35593912,4.0336547,0.18900152,2.3414233,0.39735043,0.09050506,0.30872685,0.07381979,0.71605176,0.6869745,0.081249595,0.69044006,0.5150182,1.2590765,0.6980167,0.04043223,0.673244,0.09049936,0.26616058,0.40685436,0.8606266,0.24683805,0.191125,0.011847176,1.5151157,0.5534616,0.24387255,0.3518129,0.93591785,0.07363381,1.3360152,0.088130616,0.14339618]'
LIMIT 1;

SELECT *
from image_vectors






About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages